From 1d350b3384d8cf0b6d5929bd8e5a3083c0f0c916 Mon Sep 17 00:00:00 2001 From: Amogh-Bharadwaj Date: Mon, 27 Nov 2023 19:23:34 +0530 Subject: [PATCH] quote watermark table --- ui/app/mirrors/create/handlers.ts | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/ui/app/mirrors/create/handlers.ts b/ui/app/mirrors/create/handlers.ts index 3f90b37297..f65ecc8fd8 100644 --- a/ui/app/mirrors/create/handlers.ts +++ b/ui/app/mirrors/create/handlers.ts @@ -187,6 +187,15 @@ export const handleCreateCDC = async ( setLoading(false); }; +const quotedWatermarkTable = (watermarkTable: string): string => { + if (watermarkTable.includes('.')) { + const [schema, table] = watermarkTable.split('.'); + return `"${schema}"."${table}"`; + } else { + return `"${watermarkTable}"`; + } +}; + export const handleCreateQRep = async ( flowJobName: string, query: string, @@ -210,7 +219,9 @@ export const handleCreateQRep = async ( if (xmin == true) { config.watermarkColumn = 'xmin'; - config.query = `SELECT * FROM ${config.watermarkTable} WHERE xmin::text::bigint BETWEEN {{.start}} AND {{.end}}`; + config.query = `SELECT * FROM ${quotedWatermarkTable( + config.watermarkTable + )} WHERE xmin::text::bigint BETWEEN {{.start}} AND {{.end}}`; query = config.query; config.initialCopyOnly = false; }