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

From: "shiy(dot)fnst(at)fujitsu(dot)com" <shiy(dot)fnst(at)fujitsu(dot)com>
To: Önder Kalacı <onderkalaci(at)gmail(dot)com>, Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
Cc: 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 10:07:11
Message-ID: OSZPR01MB6310ECDBC2F9477739AEA22EFD819@OSZPR01MB6310.jpnprd01.prod.outlook.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Mar 21, 2023 4:51 PM Önder Kalacı <onderkalaci(at)gmail(dot)com> wrote:
>
> Hi Amit, Shi Yu
>
> Now attaching the similar patches for generated columns.
>

Thanks for your patches. Here are some comments.

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.

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.

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;

Regards,
Shi Yu

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Alvaro Herrera 2023-03-21 10:28:49 Re: MERGE ... WHEN NOT MATCHED BY SOURCE
Previous Message Ants Aasma 2023-03-21 10:03:21 Re: Option to not use ringbuffer in VACUUM, using it in failsafe mode