From 8c2d0f594c99d7c1ccfcee2614678c824b541fa1 Mon Sep 17 00:00:00 2001 From: mike12345567 Date: Tue, 1 Aug 2023 18:18:53 +0100 Subject: [PATCH 1/2] Quick fix for utilising a hyphen in a Postgres schema - this needed to be escaped correctly. --- packages/server/scripts/integrations/postgres/init.sql | 6 +++--- packages/server/src/integrations/postgres.ts | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/server/scripts/integrations/postgres/init.sql b/packages/server/scripts/integrations/postgres/init.sql index 5e385c12d7..6cb3f51269 100644 --- a/packages/server/scripts/integrations/postgres/init.sql +++ b/packages/server/scripts/integrations/postgres/init.sql @@ -1,6 +1,6 @@ SELECT 'CREATE DATABASE main' WHERE NOT EXISTS (SELECT FROM pg_database WHERE datname = 'main')\gexec -CREATE SCHEMA test; +CREATE SCHEMA "test-1"; CREATE TYPE person_job AS ENUM ('qa', 'programmer', 'designer'); CREATE TABLE Persons ( PersonID SERIAL PRIMARY KEY, @@ -39,7 +39,7 @@ CREATE TABLE Products_Tasks ( REFERENCES Tasks(TaskID), PRIMARY KEY (ProductID, TaskID) ); -CREATE TABLE test.table1 ( +CREATE TABLE "test-1".table1 ( id SERIAL PRIMARY KEY, Name varchar(255) ); @@ -60,7 +60,7 @@ INSERT INTO Products_Tasks (ProductID, TaskID) VALUES (1, 1); INSERT INTO Products_Tasks (ProductID, TaskID) VALUES (2, 1); INSERT INTO Products_Tasks (ProductID, TaskID) VALUES (3, 1); INSERT INTO Products_Tasks (ProductID, TaskID) VALUES (1, 2); -INSERT INTO test.table1 (Name) VALUES ('Test'); +INSERT INTO "test-1".table1 (Name) VALUES ('Test'); INSERT INTO CompositeTable (KeyPartOne, KeyPartTwo, Name) VALUES ('aaa', 'bbb', 'Michael'); INSERT INTO CompositeTable (KeyPartOne, KeyPartTwo, Name) VALUES ('bbb', 'ccc', 'Andrew'); INSERT INTO CompositeTable (KeyPartOne, KeyPartTwo, Name) VALUES ('ddd', '', 'OneKey'); diff --git a/packages/server/src/integrations/postgres.ts b/packages/server/src/integrations/postgres.ts index b16f5b858b..c4b7c2bb65 100644 --- a/packages/server/src/integrations/postgres.ts +++ b/packages/server/src/integrations/postgres.ts @@ -210,7 +210,7 @@ class PostgresIntegration extends Sql implements DatasourcePlus { if (!this.config.schema) { this.config.schema = "public" } - await this.client.query(`SET search_path TO ${this.config.schema}`) + await this.client.query(`SET search_path TO "${this.config.schema}"`) this.COLUMNS_SQL = `select * from information_schema.columns where table_schema = '${this.config.schema}'` this.open = true } From 063942d21cc79791981518ac2907c0969931d677 Mon Sep 17 00:00:00 2001 From: Budibase Staging Release Bot <> Date: Wed, 2 Aug 2023 12:22:47 +0000 Subject: [PATCH 2/2] Bump version to 2.8.29-alpha.12 --- lerna.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lerna.json b/lerna.json index 74a1392bf9..13fc86bb18 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { - "version": "2.8.29-alpha.11", + "version": "2.8.29-alpha.12", "npmClient": "yarn", "packages": [ "packages/*"