Re: relcache not invalidated when ADD PRIMARY KEY USING INDEX

Julien Rouhaud <rjuju123@gmail.com>

From: Julien Rouhaud <rjuju123@gmail.com>
To: "houzj.fnst@fujitsu.com" <houzj.fnst@fujitsu.com>
Cc: PostgreSQL Hackers <pgsql-hackers@postgresql.org>
Date: 2022-01-14T06:34:49Z
Lists: pgsql-hackers
Hi,

On Mon, Dec 20, 2021 at 06:45:33AM +0000, houzj.fnst@fujitsu.com wrote:
> 
> I tried to write a patch to fix this by invalidating the relcache after marking
> primary key in index_constraint_create().

The cfbot reports that you have a typo in your regression tests:

https://api.cirrus-ci.com/v1/artifact/task/4806573636714496/regress_diffs/contrib/test_decoding/regression.diffs
diff -U3 /tmp/cirrus-ci-build/contrib/test_decoding/expected/ddl.out /tmp/cirrus-ci-build/contrib/test_decoding/results/ddl.out
--- /tmp/cirrus-ci-build/contrib/test_decoding/expected/ddl.out	2022-01-11 16:46:51.684727957 +0000
+++ /tmp/cirrus-ci-build/contrib/test_decoding/results/ddl.out	2022-01-11 16:50:35.584089784 +0000
@@ -594,7 +594,7 @@
 DELETE FROM table_dropped_index_no_pk WHERE b = 1;
 DELETE FROM table_dropped_index_no_pk WHERE a = 3;
 DROP TABLE table_dropped_index_no_pk;
--- check table with newly added primary key
+-- check tables with newly added primary key

Could you send an updated patch?  As far as I can see the rest of the
regression tests succeed so the patch can probably still be reviewed.  That
being said, there are pending comments by Euler so I think it's appropriate to
zsh:1: command not found: q



Commits

  1. Flush table's relcache during ALTER TABLE ADD PRIMARY KEY USING INDEX.