From: | Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> |
---|---|
To: | "Zhijie Hou (Fujitsu)" <houzj(dot)fnst(at)fujitsu(dot)com> |
Cc: | shveta malik <shveta(dot)malik(at)gmail(dot)com>, Nisha Moond <nisha(dot)moond412(at)gmail(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>, Dilip Kumar <dilipbalaut(at)gmail(dot)com>, Jan Wieck <jan(at)wi3ck(dot)info>, Tomas Vondra <tomas(dot)vondra(at)enterprisedb(dot)com>, Ashutosh Bapat <ashutosh(dot)bapat(dot)oss(at)gmail(dot)com> |
Subject: | Re: Conflict detection and logging in logical replication |
Date: | 2024-08-05 04:20:38 |
Message-ID: | CAA4eK1L5vh8YGZ2Ec9M5HbGcN6uf0OZtUV583LmFXZHCUXO3Jw@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Sun, Aug 4, 2024 at 1:04 PM Zhijie Hou (Fujitsu)
<houzj(dot)fnst(at)fujitsu(dot)com> wrote:
>
> On Friday, July 26, 2024 2:26 PM Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> wrote:
> >
> >
> > I agree that displaying pk where applicable should be okay as we display it at
> > other places but the same won't be possible when we do sequence scan to
> > fetch the required tuple. So, the message will be different in that case, right?
>
> After some research, I think we can report the key values in DETAIL if the
> apply worker uses any unique indexes to find the tuple to update/delete.
> Otherwise, we can try to output all column values in DETAIL if the current user
> of apply worker has SELECT access to these columns.
>
I don't see any problem with displaying the column values in the LOG
message when the user can access it. Also, we do the same in other
places to further strengthen this idea.
> This is consistent with what we do when reporting table constraint violation
> (e.g. when violating a check constraint, it could output all the column value
> if the current has access to all the column):
>
> - First, use super user to create a table.
> CREATE TABLE t1 (c1 int, c2 int, c3 int check (c3 < 5));
>
> - 1) using super user to insert a row that violates the constraint. We should
> see all the column value.
>
> INSERT INTO t1(c3) VALUES (6);
> ERROR: new row for relation "t1" violates check constraint "t1_c3_check"
> DETAIL: Failing row contains (null, null, 6).
>
> - 2) use a user without access to all the columns. We can only see the inserted column and
> CREATE USER regress_priv_user2;
> GRANT INSERT (c1, c2, c3) ON t1 TO regress_priv_user2;
>
> SET SESSION AUTHORIZATION regress_priv_user2;
> INSERT INTO t1 (c3) VALUES (6);
>
> ERROR: new row for relation "t1" violates check constraint "t1_c3_check"
> DETAIL: Failing row contains (c3) = (6).
>
> To achieve this, I think we can expose the ExecBuildSlotValueDescription
> function and use it in conflict reporting. What do you think ?
>
Agreed. We should also consider displaying both the local and remote
rows in case of update/delete_differ conflicts. Do, we have any case
during conflict reporting where we won't have access to any of the
columns? If so, we need to see what to display in such a case.
--
With Regards,
Amit Kapila.
From | Date | Subject | |
---|---|---|---|
Next Message | vignesh C | 2024-08-05 04:29:54 | Re: Logical Replication of sequences |
Previous Message | shveta malik | 2024-08-05 04:15:23 | Re: Conflict detection and logging in logical replication |