From 3fbc4c3b630060afb3498f773acd5ce90a7d3eff Mon Sep 17 00:00:00 2001 From: hasura-bot Date: Fri, 23 Apr 2021 20:31:35 +0530 Subject: [PATCH] console: quote postgres table name when creating one with a comment GITHUB_PR_NUMBER: 6761 GITHUB_PR_URL: https://github.com/hasura/graphql-engine/pull/6761 Co-authored-by: Ross Gardiner <565371+rossng@users.noreply.github.com> GitOrigin-RevId: 9fbe6d53724028329b639441b98dff685e5e067e --- CHANGELOG.md | 2 +- console/src/dataSources/services/postgresql/sqlUtils.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4055b1eab7f..8548baaab81 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ (Add entries below in the order of: server, console, cli, docs, others) - server: fix regression: `on_conflict` was missing in the schema for inserts in tables where the current user has no columns listed in their update permissions (fix #6804) +- console: fix Postgres table creation when table has a non-lowercase name and a comment (#6760) - cli: fix regression - `metadata apply —dry-run` was overwriting local metadata files with metadata on server when it should just display the differences. - cli: add support for `api_limits` metadata object @@ -81,7 +82,6 @@ In the future, we will probably offer a way to explicitly choose which behaviour - console: add request preview for REST endpoints - cli: fix errors being ignored during `metadata apply` in config v3 (fix #6784) - ## v2.0.0-alpha.7 ### Transactions for Postgres mutations diff --git a/console/src/dataSources/services/postgresql/sqlUtils.ts b/console/src/dataSources/services/postgresql/sqlUtils.ts index 4b8533040cb..922846d563e 100644 --- a/console/src/dataSources/services/postgresql/sqlUtils.ts +++ b/console/src/dataSources/services/postgresql/sqlUtils.ts @@ -382,7 +382,7 @@ export const getCreateTableQueries = ( // add comment if (tableComment && tableComment !== '') { - sqlCreateTable += `COMMENT ON TABLE "${currentSchema}".${tableName} IS ${sqlEscapeText( + sqlCreateTable += `COMMENT ON TABLE "${currentSchema}"."${tableName}" IS ${sqlEscapeText( tableComment )};`; }