PostgreSQLで関数は普通こんな形でselect以下に書いて実行します。
postgres=# select sqrt(144);
sqrt
------
12
(1 row)
普通の関数は上のでOK
しかし、record型を返す関数の場合はこの形で指定するとレコードがすべて1カラムに入って帰ってくるのでみずらい
postgres=# select pg_get_keywords();
pg_get_keywords
------------------------------------------------------------------
(abort,U,unreserved)
(absolute,U,unreserved)
(access,U,unreserved)
(action,U,unreserved)
(add,U,unreserved)
(admin,U,unreserved)
(after,U,unreserved)
(aggregate,U,unreserved)
(all,R,reserved)
(also,U,unreserved)
where句に入れるとレコードで帰ってくるよ
みやすい!
postgres=# select * from pg_get_keywords();
word | catcode | catdesc
-------------------+---------+----------------------------------------------
abort | U | unreserved
absolute | U | unreserved
access | U | unreserved
action | U | unreserved
add | U | unreserved
admin | U | unreserved
after | U | unreserved
aggregate | U | unreserved
all | R | reserved
also | U | unreserved