fix: Updating query for types to the target namespace
This commit is contained in:
parent
c9e627d333
commit
b22ab17b38
1 changed files with 8 additions and 5 deletions
|
|
@ -35,14 +35,14 @@ WITH primaryKeys AS (
|
||||||
SELECT column_name
|
SELECT column_name
|
||||||
FROM information_schema.key_column_usage AS c
|
FROM information_schema.key_column_usage AS c
|
||||||
LEFT JOIN information_schema.table_constraints AS t
|
LEFT JOIN information_schema.table_constraints AS t
|
||||||
ON t.constraint_name = c.constraint_name AND
|
ON t.constraint_name = c.constraint_name AND
|
||||||
c.table_schema = t.table_schema AND
|
c.table_schema = t.table_schema AND
|
||||||
c.table_name = t.table_name
|
c.table_name = t.table_name
|
||||||
WHERE t.table_schema = $1 AND t.table_name = $2 AND t.constraint_type = 'PRIMARY KEY'
|
WHERE t.table_schema = $1 AND t.table_name = $2 AND t.constraint_type = 'PRIMARY KEY'
|
||||||
)
|
)
|
||||||
SELECT column_name as "column.Name",
|
SELECT column_name as "column.Name",
|
||||||
is_nullable = 'YES' as "column.isNullable",
|
is_nullable = 'YES' as "column.isNullable",
|
||||||
(EXISTS(SELECT 1 from primaryKeys as pk where pk.column_name = columns.column_name)) as "column.IsPrimaryKey",
|
(EXISTS(SELECT 1 from primaryKeys as pk where pk.column_name = columns.column_name)) as "column.IsPrimaryKey",
|
||||||
dataType.kind as "dataType.Kind",
|
dataType.kind as "dataType.Kind",
|
||||||
(case dataType.Kind when 'base' then data_type else LTRIM(udt_name, '_') end) as "dataType.Name",
|
(case dataType.Kind when 'base' then data_type else LTRIM(udt_name, '_') end) as "dataType.Name",
|
||||||
FALSE as "dataType.isUnsigned"
|
FALSE as "dataType.isUnsigned"
|
||||||
|
|
@ -50,7 +50,10 @@ FROM information_schema.columns,
|
||||||
LATERAL (select (case data_type
|
LATERAL (select (case data_type
|
||||||
when 'ARRAY' then 'array'
|
when 'ARRAY' then 'array'
|
||||||
when 'USER-DEFINED' then
|
when 'USER-DEFINED' then
|
||||||
case (select typtype from pg_type where typname = columns.udt_name)
|
case (select t.typtype
|
||||||
|
from pg_type as t
|
||||||
|
join pg_namespace as p on p.oid = t.typnamespace
|
||||||
|
where t.typname = columns.udt_name and p.nspname = $1)
|
||||||
when 'e' then 'enum'
|
when 'e' then 'enum'
|
||||||
else 'user-defined'
|
else 'user-defined'
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue