From 30f1ebe4ee4d54f26b41d7e9fb351e3ea6826312 Mon Sep 17 00:00:00 2001 From: StrikeW Date: Fri, 17 May 2024 11:32:42 +0800 Subject: [PATCH] fix(postgres-cdc): fix validation of PK with uppercase (#16793) --- e2e_test/source/cdc/cdc.load.slt | 2 +- e2e_test/source/cdc/postgres_cdc.sql | 4 ++-- .../risingwave/connector/source/common/PostgresValidator.java | 3 +-- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/e2e_test/source/cdc/cdc.load.slt b/e2e_test/source/cdc/cdc.load.slt index 6de27bfe8e5d..2c372cbd3ffd 100644 --- a/e2e_test/source/cdc/cdc.load.slt +++ b/e2e_test/source/cdc/cdc.load.slt @@ -161,7 +161,7 @@ create table shipments_2 ( # Test user-provided publication statement ok create table t1_rw ( - v1 int primary key, + "V1" int primary key, v3 varchar ) with ( connector = 'postgres-cdc', diff --git a/e2e_test/source/cdc/postgres_cdc.sql b/e2e_test/source/cdc/postgres_cdc.sql index 6a60644ad698..b936fb7876ad 100644 --- a/e2e_test/source/cdc/postgres_cdc.sql +++ b/e2e_test/source/cdc/postgres_cdc.sql @@ -31,8 +31,8 @@ INSERT INTO person VALUES (1001, 'peter white', 'myckhsp@xpmpe.com', '1781 2313 INSERT INTO person VALUES (1002, 'sarah spencer', 'wipvdbm@dkaap.com', '3453 4987 9481 6270', 'los angeles'); create schema abs; -create table abs.t1 (v1 int primary key, v2 double precision, v3 varchar, v4 numeric); -create publication my_publicaton for table abs.t1 (v1, v3); +create table abs.t1 ("V1" int primary key, v2 double precision, v3 varchar, v4 numeric); +create publication my_publicaton for table abs.t1 ("V1", v3); insert into abs.t1 values (1, 1.1, 'aaa', '5431.1234'); diff --git a/java/connector-node/risingwave-connector-service/src/main/java/com/risingwave/connector/source/common/PostgresValidator.java b/java/connector-node/risingwave-connector-service/src/main/java/com/risingwave/connector/source/common/PostgresValidator.java index d91e5f885d60..084843672cb6 100644 --- a/java/connector-node/risingwave-connector-service/src/main/java/com/risingwave/connector/source/common/PostgresValidator.java +++ b/java/connector-node/risingwave-connector-service/src/main/java/com/risingwave/connector/source/common/PostgresValidator.java @@ -180,8 +180,7 @@ private void validateTableSchema() throws SQLException { var pkFields = new HashSet(); while (res.next()) { var name = res.getString(1); - // RisingWave always use lower case for column name - pkFields.add(name.toLowerCase()); + pkFields.add(name); } if (!ValidatorUtils.isPrimaryKeyMatch(tableSchema, pkFields)) {