Re: [HACKERS] GSoC 2017: Foreign Key Arrays - Mailing list pgsql-hackers

From Joel Jacobson
Subject Re: [HACKERS] GSoC 2017: Foreign Key Arrays
Date
Msg-id c18cfa88-0174-4066-a247-9ce210ed7ef0@www.fastmail.com
Whole thread Raw
In response to Re: [HACKERS] GSoC 2017: Foreign Key Arrays  (Mark Rofail <markm.rofail@gmail.com>)
Responses Re: [HACKERS] GSoC 2017: Foreign Key Arrays  ("Joel Jacobson" <joel@compiler.org>)
List pgsql-hackers
On Sun, Jan 24, 2021, at 21:46, Mark Rofail wrote:
>Thank you for this find, please find the fix below

Many thanks for fixing. I can confirm it now works like expected for the reported case:

CREATE SCHEMA catalog_clone;
CREATE TABLE catalog_clone.pg_proc AS SELECT * FROM pg_catalog.pg_proc;
CREATE TABLE catalog_clone.pg_type AS SELECT * FROM pg_catalog.pg_type;
ALTER TABLE catalog_clone.pg_type ADD PRIMARY KEY (oid);
ALTER TABLE catalog_clone.pg_proc ADD FOREIGN KEY (EACH ELEMENT OF proargtypes) REFERENCES catalog_clone.pg_type (oid);
UPDATE catalog_clone.pg_proc SET proargtypes = '19 25 12345'::oidvector WHERE oid = 79;
ERROR:  insert or update on table "pg_proc" violates foreign key constraint "pg_proc_proargtypes_fkey"
DETAIL:  Key (EACH ELEMENT OF proargtypes)=(19 25 12345) is not present in table "pg_type".

Excellent!

I'll continue testing over the next couple of days and report if I find any more oddities.

/Joel

pgsql-hackers by date:

Previous
From: "tsunakawa.takay@fujitsu.com"
Date:
Subject: RE: libpq debug log
Next
From: Masahiko Sawada
Date:
Subject: Re: New IndexAM API controlling index vacuum strategies