diff --git a/src/pgsql/pgsql-schema.lisp b/src/pgsql/pgsql-schema.lisp index 8a6f3ad..0b11653 100644 --- a/src/pgsql/pgsql-schema.lisp +++ b/src/pgsql/pgsql-schema.lisp @@ -108,10 +108,11 @@ :single))) -(defvar *table-type* '((:table . "r") - (:view . "v") - (:index . "i") - (:sequence . "S")) +(defvar *table-type* + '((:table . ("r" "f" "p")) ; ordinary, foreign and partitioned + (:view . ("v")) + (:index . ("i")) + (:sequence . ("S"))) "Associate internal table type symbol with what's found in PostgreSQL pg_class.relkind column.") diff --git a/src/pgsql/sql/list-all-columns.sql b/src/pgsql/sql/list-all-columns.sql index ce3b634..d3223e1 100644 --- a/src/pgsql/sql/list-all-columns.sql +++ b/src/pgsql/sql/list-all-columns.sql @@ -16,7 +16,7 @@ and a.attnum = def.adnum where nspname !~~ '^pg_' and n.nspname <> 'information_schema' - and relkind = '~a' + and relkind in (~{'~a'~^, ~}) ~:[~*~;and (~{~a~^~&~10t or ~})~] ~:[~*~;and (~{~a~^~&~10t and ~})~] diff --git a/src/pgsql/sql/list-all-fkeys.sql b/src/pgsql/sql/list-all-fkeys.sql index cd53ab1..8ebe8b5 100644 --- a/src/pgsql/sql/list-all-fkeys.sql +++ b/src/pgsql/sql/list-all-fkeys.sql @@ -27,7 +27,8 @@ JOIN pg_class cf on r.confrelid = cf.oid JOIN pg_namespace nf on cf.relnamespace = nf.oid where r.contype = 'f' - AND c.relkind = 'r' and cf.relkind = 'r' + AND c.relkind in ('r', 'f', 'p') + AND cf.relkind in ('r', 'f', 'p') AND n.nspname !~~ '^pg_' and n.nspname <> 'information_schema' AND nf.nspname !~~ '^pg_' and nf.nspname <> 'information_schema' ~:[~*~;and (~{~a~^~&~10t or ~})~]