http://www.joeconway.com/presentations/function_basics.pdf
CREATE FUNCTION myappend(anyarray, anyelement) RETURNS anyarray AS $$ SELECT $1 || $2; $$ LANGUAGE SQL;
查询一:
pgsql=# SELECT myappend(ARRAY[42,6], 21); myappend ----------- {42,6,21} (1 row) pgsql=#
查询二:
pgsql=# SELECT myappend(ARRAY['abc','def'], 'xyz'); myappend --------------- {abc,def,xyz} (1 row) pgsql=#
查询三:
pgsql=# SELECT myappend(ARRAY['abc','def','kkk'], 'xyz'); myappend ------------------- {abc,def,kkk,xyz} (1 row) pgsql=#