Re: [HACKERS] GSoC 2017: Foreign Key Arrays

From: Mark Rofail <markm(dot)rofail(at)gmail(dot)com>
To: Joel Jacobson <joel(at)compiler(dot)org>
Cc: Zhihong Yu <zyu(at)yugabyte(dot)com>, Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>, Alexander Korotkov <aekorotkov(at)gmail(dot)com>, Andreas Karlsson <andreas(at)proxel(dot)se>, David Steele <david(at)pgmasters(dot)net>, Erik Rijkers <er(at)xs4all(dot)nl>, Hans-Jürgen Schönig <hs(at)cybertec(dot)at>, Robert Haas <robertmhaas(at)gmail(dot)com>, Stephen Frost <sfrost(at)snowman(dot)net>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>, Michael Paquier <michael(at)paquier(dot)xyz>
Subject: Re: [HACKERS] GSoC 2017: Foreign Key Arrays
Date: 2021-01-27 09:58:01
Message-ID: CAJvoCussPoxQZniNi_or4LqZv7w4UACVytdWdJYHEeO4RhTrYA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi Joel,

As always, great catch!
Kindly find the updated patch (v15) below

Changelog:
- v15 (compatible with current master 2021-01-27, commit
e42b3c3bd6a9c6233ac4c8a2e9b040367ba2f97c)
* remove "EACH ELEMENT OF" from violation messages
* accommodate tests accordingly

Keep up the good work testing this patch.

/Mark

On Wed, Jan 27, 2021 at 5:11 AM Joel Jacobson <joel(at)compiler(dot)org> wrote:

> On Tue, Jan 26, 2021, at 12:59, Mark Rofail wrote:
> > Please don't hesitate to give your feedback.
>
> The error message for insert or update violations looks fine:
>
> UPDATE catalog_clone.pg_extension SET extconfig = ARRAY[12345] WHERE oid =
> 10;
> ERROR: insert or update on table "pg_extension" violates foreign key
> constraint "pg_extension_extconfig_fkey"
> DETAIL: Key (EACH ELEMENT OF extconfig)=(12345) is not present in table
> "pg_class".
>
> But when trying to delete a still referenced row,
> the column mentioned in the "EACH ELEMENT OF" sentence
> is not the array column, but the column in the referenced table:
>
> DELETE FROM catalog_clone.pg_class WHERE oid = 10;
> ERROR: update or delete on table "pg_class" violates foreign key
> constraint "pg_extension_extconfig_fkey" on table "pg_extension"
> DETAIL: Key (EACH ELEMENT OF oid)=(10) is still referenced from table
> "pg_extension".
>
> I think either the "EACH ELEMENT OF" part of the latter error message
> should be dropped,
> or the column name for the array column should be used.
>
> /Joel
>

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Pavel Stehule 2021-01-27 09:58:02 Re: poc - possibility to write window function in PL languages
Previous Message japin 2021-01-27 09:56:36 Re: Support ALTER SUBSCRIPTION ... ADD/DROP PUBLICATION ... syntax