select exists (select oid from users) - Mailing list pgsql-hackers

From The Hermit Hacker
Subject select exists (select oid from users)
Date
Msg-id Pine.BSF.4.21.0002292316110.434-100000@thelab.hub.org
Whole thread Raw
List pgsql-hackers
==============================
From: Don Baccus <dhogaza@pacifier.com>

The query "select exists (select oid from users)" is very
non-standard and I'm surprised it works.  I can accept that
some very weird queries might mess up PL/pgSQL, but it would
be nice if the backend wouldn't crash.

Again, PG7.0 beta (actually, a snapshot taken four days earlier,
I've given up on the official beta for the time being)

acs=# select exists (select oid from users);?column? 
----------t
(1 row)

acs=# create function foo(integer) returns boolean as '
acs'# begin
acs'#   return exists (select oid from users);
acs'# end;' language 'plpgsql';
CREATE
acs=# select foo(3);
pqReadData() -- backend closed the channel unexpectedly.       This probably means the backend terminated abnormally
  before or while processing the request.
 
The connection to the server was lost. Attempting reset: Failed.
!# \q
[acs@gyrfalcon acs]$ psql
Welcome to psql, the PostgreSQL interactive terminal.
...
acs=# create function bar(integer) returns boolean as '
acs'# begin
acs'#   return ''t'' where exists (select oid from users);
acs'# end;' language 'plpgsql';
CREATE
acs=# select bar(3);bar 
-----t
(1 row)




- Don Baccus, Portland OR <dhogaza@pacifier.com> Nature photos, on-line guides, Pacific Northwest Rare Bird Alert
Serviceand other goodies at http://donb.photo.net.
 




pgsql-hackers by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: [HACKERS] Bug report for 7.0beta1 in 'CREATE FUNCTION...'
Next
From: The Hermit Hacker
Date:
Subject: Poll: Databases for Linux