On Sun, Aug 4, 2024 at 1:04 PM Zhijie Hou (Fujitsu) <houzj.f...@fujitsu.com> wrote: > > On Friday, July 26, 2024 2:26 PM Amit Kapila <amit.kapil...@gmail.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.