Re: What do I do with this error? - Mailing list pgsql-sql

From Tom Lane
Subject Re: What do I do with this error?
Date
Msg-id 8897.984975741@sss.pgh.pa.us
Whole thread Raw
In response to Re: What do I do with this error?  ("Josh Berkus" <josh@agliodbs.com>)
Responses Re: What do I do with this error?
List pgsql-sql
"Josh Berkus" <josh@agliodbs.com> writes:
> Er, Tom, I'm using 7.1.
> Pgsql does return a null as expected when going from the command line.
> However, if I call the regular expression from within a PL/pgSQL
> function, it bombs.

Well, that's more interesting, but I still can't reproduce it ...

regression=# \df+ test1
                               List of functionsResult  | Function | Arguments |  Owner   | Language |
                                      Source                                                                  |
Description

---------+----------+-----------+----------+----------+-------------------------
--------------------------------------------------------------------------------
-------------------------------------------------------------------+------------
-integer | test1    |           | postgres | plpgsql  | declare
expression1 VARCHAR;
return_value INT4;
BEGIN
expression1 := NULL;
SELECT id INTO return_value
FROM table1
WHERE field2 ~* expression1;
RETURN return_value;
END;|
(1 row)

regression=# create table table1 (id int, field2 text);
CREATE
regression=# select test1();test1
-------

(1 row)

regression=# insert into table1 values(1,'zz');
INSERT 1273361 1
regression=# select test1();test1
-------

(1 row)

regression=# insert into table1 values(1,null);
INSERT 1273362 1
regression=# select test1();test1
-------

(1 row)


        regards, tom lane


pgsql-sql by date:

Previous
From: Stephan Szabo
Date:
Subject: Re: What do I do with this error?
Next
From: Karel Zak
Date:
Subject: Re: hierarchical order equivalent