You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a situation where the same user-defined-type name is re-used across two different schema in the same database, and it breaks the process.
i think the query that constructs the columns of a table needs a small tweak :
Line 32 on schema_inspector.rs needs to change from :
const TABLE_COLUMNS_QUERY: &str = "SELECT cc.column_name, cc.ordinal_position, cc.data_type, pt.oid
FROM information_schema.columns as cc
JOIN pg_catalog.pg_type as pt
ON cc.udt_name = pt.typname
WHERE cc.table_schema = $1 and cc.table_name = $2
ORDER BY cc.ordinal_position ASC";
to
const TABLE_COLUMNS_QUERY: &str = "SELECT cc.column_name, cc.ordinal_position, cc.data_type, pt.oid
FROM information_schema.columns as cc
JOIN pg_catalog.pg_type as pt
ON cc.udt_name = pt.typname
LEFT JOIN pg_catalog.pg_namespace as pn
ON (
cc.data_type = 'USER-DEFINED'
AND cc.table_schema = pn.nspname
and pn.oid = pt.typnamespace
)
WHERE cc.table_schema = $1 and cc.table_name = $2
AND ( cc.data_type <> 'USER-DEFINED' OR pn.nspname is not null )
ORDER BY cc.ordinal_position ASC";
Mainly, it is ensuring that the schema name is used when finding the type of a column, when the type is user-defined.
The text was updated successfully, but these errors were encountered:
Folks,
I have a situation where the same user-defined-type name is re-used across two different schema in the same database, and it breaks the process.
i think the query that constructs the columns of a table needs a small tweak :
Line 32 on schema_inspector.rs needs to change from :
to
Mainly, it is ensuring that the schema name is used when finding the type of a column, when the type is user-defined.
The text was updated successfully, but these errors were encountered: