Thara Vadakkeveedu <tharagv@xxxxxxxxx> wrote: > By itself this sql works: > SELECT 0 FROM pg_class > WHERE relkind = 'S' > AND oid = ('public.' || quote_ident('hibernate_sequence'))::regclass; > > However when I create a function for it and run it I see an error > > create function chk_sequence() returns integer as $$ > BEGIN > IF EXISTS (SELECT 1 FROM pg_class > WHERE relkind = 'S' > AND oid = ('public.' || quote_ident('hibernate_sequence')))::regclass > THEN > return 1; > ELSE > return 0; > END IF; > END; > $$ language plpgsql; Move the cast to regclass inside one level of parentheses. -- Kevin Grittner EDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company -- Sent via pgsql-admin mailing list (pgsql-admin@xxxxxxxxxxxxxx) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-admin