Skip to main content

Create table and test

Connect to PostgreSQL

If your DB name is mydb:


psql -U postgres -W -d mydb

OR using the Debezium user (read-only but good for testing SELECT):


psql -U debezium -W -d mydb

2. Create a table

Inside psql:


CREATE TABLE users ( id SERIAL PRIMARY KEY, name VARCHAR(100), email VARCHAR(150), created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP );

Debezium will track this table because:

  • You created a publication with FOR ALL TABLES

  • Debezium captures all changes in the public schema


3. Insert sample data


INSERT INTO users (name, email) VALUES ('Golam Kibria', 'gkibria@example.com'), ('John Doe', 'john@example.com'), ('Alice Rahman', 'alice@example.com');

4. Query table to confirm


SELECT * FROM users;

You should see:


id | name | email | created_at ----+---------------+----------------------+------------------------ 1 | Golam Kibria | gkibria@example.com | 2025-11-30 23:50:12 2 | John Doe | john@example.com | 2025-11-30 23:50:12 3 | Alice Rahman | alice@example.com | 2025-11-30 23:50:12

📡 5. Verify Debezium CDC events (optional)

In Kafka, list topics:


/opt/kafka/bin/kafka-topics.sh --bootstrap-server localhost:9092 --list

Expected:


pg.public.users pg.public.users-value pg.public.users-key

Consume the topic:


/opt/kafka/bin/kafka-console-consumer.sh \ --bootstrap-server localhost:9092 \ --topic pg.public.users \ --from-beginning