Re: PgOutput Replication Message Format - Differentiate between explicit NULL and Omitted Columns during Insert

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Pranav Hegde <pranavh4(at)gmail(dot)com>
Cc: pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: PgOutput Replication Message Format - Differentiate between explicit NULL and Omitted Columns during Insert
Date: 2023-04-05 14:24:45
Message-ID: 1834632.1680704685@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Pranav Hegde <pranavh4(at)gmail(dot)com> writes:
> Currently in the PgOutput messages for Insert statements, there is no way
> to differentiate if the column was explicitly set to null in the insert
> statement, or whether that column was omitted in the insert statement and
> thus set to null (or default value)

Nope. Replication works at the data level, it has no idea how that
data was formed originally.

> Thus we are not able to identify which column was explicitly set to null
> and which column was set to the default value.
> This causes issues when we are parsing the message, especially in libraries
> such as Debezium, where it returns the default value for the column, even
> though in the actual SQL query we set that column to be explicitly null.

If you have code that changes the data supplied, that code is wrong.
We are not likely to change the replication protocol to support it.

regards, tom lane

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Steve Rogerson 2023-04-05 15:02:28 Re: Possible old and fixed bug in Postgres?
Previous Message Tom Lane 2023-04-05 14:16:56 Re: Possible old and fixed bug in Postgres?