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 looked around and in "api/peers/schemas" (file) catches Schemas with this table:
pg_namespace which does not preserve the double quotations!
but when selecting columns table pg_class is used which double quotation is preserved so the condition
relnamespace::regnamespace::text ='some' won't work.
I may suggest the fix to add this join to the GetColumns script and change the condition likewise so the problem will be solved.
SELECT
attname AS column_name,
format_type(atttypid, atttypmod) AS data_type,
CASE
WHEN attnum = ANY(conkey) THEN true
ELSE false
END AS is_primary_key
FROM
pg_attribute
JOIN
pg_class ON pg_attribute.attrelid = pg_class.oid
JOIN
pg_namespace on pg_class.relnamespace = pg_namespace.oid
LEFT JOIN
pg_constraint ON pg_attribute.attrelid = pg_constraint.conrelid
AND pg_attribute.attnum = ANY(pg_constraint.conkey)
WHERE
pg_namespace.nspname = $1
AND
relname = $2
AND pg_attribute.attnum > 0
AND NOT attisdropped
ORDER BY
attnum
this way the output of GetSchemas could be directly used as GetColumns input.
I consider change the GetSchemas script to get schemas from pg_class but this way empty schemas won't show up and I did not know a better place to see them.
The text was updated successfully, but these errors were encountered:
hi
I have some schemas " like this : "some"
and I cannot rename them
the problem is it won't get the column names so the Create query for destination (in my case click house) won't generate correctly
see the body of these two API calls, first one is captured when calls from the panel(removed extra fields as they are not necessary):
{
"peerName": "pg",
"schemaName": "some",
"tableName": "ssmm"
}
it will return an empty list of columns
but this body that I recreate manually fetches the columns perfectly:
{
"peerName": "pg",
"schemaName": ""some"",
"tableName": "ssmm"
}
I looked around and in "api/peers/schemas" (file) catches Schemas with this table:
pg_namespace which does not preserve the double quotations!
but when selecting columns table pg_class is used which double quotation is preserved so the condition
relnamespace::regnamespace::text ='some' won't work.
I may suggest the fix to add this join to the GetColumns script and change the condition likewise so the problem will be solved.
SELECT
attname AS column_name,
format_type(atttypid, atttypmod) AS data_type,
CASE
WHEN attnum = ANY(conkey) THEN true
ELSE false
END AS is_primary_key
FROM
pg_attribute
JOIN
pg_class ON pg_attribute.attrelid = pg_class.oid
JOIN
pg_namespace on pg_class.relnamespace = pg_namespace.oid
LEFT JOIN
pg_constraint ON pg_attribute.attrelid = pg_constraint.conrelid
AND pg_attribute.attnum = ANY(pg_constraint.conkey)
WHERE
pg_namespace.nspname = $1
AND
relname = $2
AND pg_attribute.attnum > 0
AND NOT attisdropped
ORDER BY
attnum
this way the output of GetSchemas could be directly used as GetColumns input.
I consider change the GetSchemas script to get schemas from pg_class but this way empty schemas won't show up and I did not know a better place to see them.
The text was updated successfully, but these errors were encountered: