Skip to content

Instantly share code, notes, and snippets.

@iakio
Created January 20, 2012 07:18
Show Gist options
  • Save iakio/1645953 to your computer and use it in GitHub Desktop.
Save iakio/1645953 to your computer and use it in GitHub Desktop.
ishida=# create function t(bool) returns bool as 'select true' language sql;
CREATE FUNCTION
ishida=# create aggregate exists_(*) (sfunc = t, stype = bool, initcond = false);
CREATE AGGREGATE
ishida=# select exists_(*) from pg_user;
exists_
---------
t
(1 row)
ishida=# select exists_(*) from pg_user where usename = 'hoge';
exists_
---------
f
(1 row)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment