mirror of
https://github.com/dimitri/pgloader.git
synced 2026-05-04 18:36:12 +02:00
Implement support for Foreign Tables and Partitionned Tables.
Due to the way pgloader queries the PostgreSQL catalogs, it restricted the target table to be “ordinary” tables, as per the relkind description in the https://www.postgresql.org/docs/current/static/catalog-pg-class.html PostgreSQL documentation. Extend this to support relkind of 'r', 'f' and 'p'. Fixes #587, fixes #690.
This commit is contained in:
parent
52f13456d9
commit
c05183fcba
@ -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.")
|
||||
|
||||
|
||||
@ -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 ~})~]
|
||||
|
||||
|
||||
@ -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 ~})~]
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user