Re: Dropped and generated columns might cause wrong data on subs when REPLICA IDENTITY FULL

From: Önder Kalacı <onderkalaci(at)gmail(dot)com>
To: "shiy(dot)fnst(at)fujitsu(dot)com" <shiy(dot)fnst(at)fujitsu(dot)com>
Cc: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Dropped and generated columns might cause wrong data on subs when REPLICA IDENTITY FULL
Date: 2023-03-21 12:02:58
Message-ID: CACawEhUxn6gksQx6tSneBzfU2xuc1Lsue8pZ833G8arYGedudw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi Shi Yu,

>
>
> 1.
> $node_publisher->safe_psql(
> 'postgres', qq(
> ALTER TABLE dropped_cols DROP COLUMN b_drop;
> + ALTER TABLE generated_cols DROP COLUMN b_gen;
> ));
> $node_subscriber->safe_psql(
> 'postgres', qq(
> ALTER TABLE dropped_cols DROP COLUMN b_drop;
> + ALTER TABLE generated_cols DROP COLUMN b_gen;
> ));
>
> I think we want to test generated columns, so we don't need to drop
> columns.
> Otherwise the generated column problem can't be detected.
>
>
Ow, what a mistake. Now changed (and ensured that without the patch
the test fails).

> 2.
> # The bug was that when the REPLICA IDENTITY FULL is used with dropped
> columns,
> # we fail to apply updates and deletes
>
> Maybe we should mention generated columns in comment of the test.
>
> makes sense

> 3.
> I ran pgindent and it modified some lines. Maybe we can improve the patch
> as the following.
>
> @@ -292,8 +292,8 @@ tuples_equal(TupleTableSlot *slot1, TupleTableSlot
> *slot2,
> att = TupleDescAttr(slot1->tts_tupleDescriptor, attrnum);
>
> /*
> - * Ignore dropped and generated columns as the publisher
> - * doesn't send those
> + * Ignore dropped and generated columns as the publisher
> doesn't send
> + * those
> */
> if (att->attisdropped || att->attgenerated)
> continue;
>
> fixed

Attached patches again.

Thanks,
Onder KALACI

Attachment Content-Type Size
v1-0001-REL_12-Ignore-generated-columns-during-apply-of-update-d.patch application/octet-stream 4.0 KB
v1-0001-REL_15-Ignore-generated-columns-during-apply-of-update-d.patch application/octet-stream 3.8 KB
v1-0001-REL_14-REL_13-Ignore-generated-columns-during-apply-of-update-d.patch application/octet-stream 4.0 KB
v1-0001-HEAD-Ignore-generated-columns-during-apply-of-update-d.patch application/octet-stream 3.7 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Dean Rasheed 2023-03-21 12:24:31 Re: MERGE ... WHEN NOT MATCHED BY SOURCE
Previous Message Aleksander Alekseev 2023-03-21 11:44:33 Re: [PATCH] Clarify the behavior of the system when approaching XID wraparound