err that should be (forgot the username, password placeholders)
> my $db = DBI->connect('dbi:Pg:dbname=test;', '', '', {'pg_server_prepare'=>1, 'pg_prepare_now'=>1}) || die "could not
connect:$!";
> $db->do('create table junk (junk text, junk_id int);');
> $db->do('create sequence junk_seq;');
> $db->do("create or replace function junk_func(int) returns integer as
> 'select junk_id from junk where junk_id = \$1;' language 'sql' stable
> strict;");
>
> my $sth = $db->prepare('select * from junk where junk = ? and junk_id
> = junk_func(1) limit 1;');
>
> $db->do('vacuum junk;');
> $db->begin_work();
>
> $db->do('select nextval(\'junk_seq\');');
>
> $sth->execute('test') || die "failed: $!";
> $sth->fetchall_arrayref();
>
> $db->disconnect();
>