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-24 20:46:49
Message-ID: CAJvoCust0s0Q9z4cvfc9K4Lst5pgKX0Uikp+FYatJqBrVNqiPw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hello again Joel,

UPDATE catalog_clone.pg_index SET indkey = '1 2 12345'::int2vector WHERE
>> indexrelid = 2837;
>> ERROR: operator does not exist: int2vector pg_catalog.@> smallint[]
>> LINE 1: ...WHERE "attrelid" OPERATOR(pg_catalog.=) $1 AND $2 OPERATOR(p...
>>
> In your example, you are using the notation '1 2 12345'::int2vector which
> signifies a vector as you have mentioned, however in this patch we use the
> array operator @> to help with the indexing, the incompatibility stems from
> here.
> I do not think that postgres contains vector operators, correct me if I am
> wrong. I feel that supporting vectors is our of the scope of this patch, if
> you have an idea how to support it please let me know.
>
I apologize for my rash response, I did not quite understand your example
at first, it appears the UPDATE statement is neither over the
referencing nor the referenced columns, I understand the problem now,
please disregard the previous email. Thank you for this find, please find
the fix below

Changelog:
- v14 (compatible with current master 2021-01-24,
commit 0c1e8845f28bd07ad381c8b0d6701575d967b88e)
* fix a huge issue in type casting (ruleutils.c:11438-11491)
* remove coercion support (this causes the issue Joel described above)
* remove composite types support (since search is now array against
array and "get_array_type" returns "record []" for composite functions)

Todo:
- rebase containselem gin patch to accommodate v14.
"Array-containselem-gin-v1.patch" is only compatible with <v14
- work on re-adding support to composite types

/Mark

Attachment Content-Type Size
Array-ELEMENT-foreign-key-v14.patch text/x-patch 110.1 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message tsunakawa.takay@fujitsu.com 2021-01-24 23:23:43 RE: Parallel INSERT (INTO ... SELECT ...)
Previous Message Laurenz Albe 2021-01-24 20:12:47 Re: Stronger safeguard for archive recovery not to miss data