"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