Can anyone suggest a more elegant way of finding foreign keys than
parsing the tgargs value returned by this query?  I'd really rather do
pure SQL, sans string parsing, if possible.

------------------------------------------------------------------------
-- Find tables and foreign keys

CREATE VIEW foreignkeysa AS
        SELECT  t.oid as toid,
                c1.relname AS relid,
                c2.relname AS constrrelid,
                t.tgargs AS tgargs

        FROM    pg_trigger AS t,
                pg_class AS c1,
                pg_class AS c2

        WHERE   t.tgrelid=c1.oid AND
                t.tgconstrrelid=c2.oid AND
                t.tgfoid=1644;
------------------------------------------------------------------------

-Ron-

Reply via email to