
==============================
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 Service and other goodies at
  http://donb.photo.net.



Tue, 29 Feb 2000 23:17:37 -0400 (AST)
The Hermit Hacker <scrappy@hub.org>
select exists (select oid from users)