mirror of
https://github.com/hasura/graphql-engine.git
synced 2024-12-14 17:02:49 +03:00
console: modify getTableColumns
SQL for postgres DAL method to include materialized views
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/9966 GitOrigin-RevId: 16fc6f7bd1c1308e27511fa6387b51564c0b9dbf
This commit is contained in:
parent
b3a128065f
commit
929773d5b4
@ -34,13 +34,20 @@ export const getTableColumns = async ({
|
|||||||
const { schema, name } = table as PostgresTable;
|
const { schema, name } = table as PostgresTable;
|
||||||
|
|
||||||
const sql = `
|
const sql = `
|
||||||
SELECT
|
SELECT a.attname as column_name,
|
||||||
column_name, data_type, is_nullable
|
pg_catalog.format_type(a.atttypid, NULL) as data_type,
|
||||||
FROM
|
case
|
||||||
information_schema.columns
|
when a.attnotnull = 'f' then 'true'
|
||||||
WHERE
|
else 'false'
|
||||||
table_schema = '${schema}' AND
|
end as is_nullable
|
||||||
table_name = '${name}';`;
|
FROM pg_attribute a
|
||||||
|
JOIN pg_class t on a.attrelid = t.oid
|
||||||
|
JOIN pg_namespace s on t.relnamespace = s.oid
|
||||||
|
WHERE a.attnum > 0
|
||||||
|
AND NOT a.attisdropped
|
||||||
|
AND t.relname = '${name}'
|
||||||
|
AND s.nspname = '${schema}'
|
||||||
|
`;
|
||||||
|
|
||||||
const tables = await runSQL({
|
const tables = await runSQL({
|
||||||
source: {
|
source: {
|
||||||
|
Loading…
Reference in New Issue
Block a user