I'm trying to create a source with postgres-cdc in RisingWave, but I'm encountering errors related to primary key constraints and syntax. Here's what I've tried:
CREATE SOURCE IF NOT EXISTS table_metadata_source (
handle character varying,
key_type text,
value_type text,
inserted_at timestamp without time zone,
) WITH (
connector = 'postgres-cdc',
hostname = '*****',
port = '5432',
username = '*****',
password = '*****',
database.name = 'postgres',
schema.name = 'public',
table.name = 'table_metadatas'
);
This resulted in an error stating that a primary key must be specified. After adding a primary key, I received another error indicating that the source does not support the PRIMARY KEY constraint and suggested using CREATE TABLE
instead. How should I proceed to create a source with postgres-cdc correctly?
Povilas Žvaliauskas
Asked on Jul 05, 2023
As indicated in the error message, you have to use CREATE TABLE
for CDC source. It seems that RisingWave does not support the PRIMARY KEY constraint for sources, and you need to use a different approach, such as creating a table, to work with CDC data.