mirror of
https://github.com/dimitri/pgloader.git
synced 2026-03-09 06:01:31 +01:00
Implement a generic-function API to discover the source database schema and populate pgloader internal version of the catalogs. Cut down three copies of about the same code-path down to a single shared one, thanks to applying some amount of OOP to the code.
17 lines
610 B
SQL
17 lines
610 B
SQL
-- params: db-name
|
|
-- table-type-name
|
|
-- only-tables
|
|
-- only-tables
|
|
-- including
|
|
-- filter-list-to-where-clause incuding
|
|
-- excluding
|
|
-- filter-list-to-where-clause excluding
|
|
select c.table_name, c.column_name, c.column_comment
|
|
from information_schema.columns c
|
|
join information_schema.tables t using(table_schema, table_name)
|
|
where c.table_schema = '~a'
|
|
and t.table_type = 'BASE TABLE'
|
|
~:[~*~;and (~{table_name ~a~^ or ~})~]
|
|
~:[~*~;and (~{table_name ~a~^ and ~})~]
|
|
order by table_name, ordinal_position;
|