| From: | Alexander Melnikov <asmmp(at)protonmail(dot)com> |
|---|---|
| To: | Arne Roland <arne(dot)roland(at)malkut(dot)net> |
| Cc: | Joel Jacobson <joel(at)compiler(dot)org>, Tomas Vondra <tomas(at)vondra(dot)me>, Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>, Anders Granlund <anders(dot)granlund(dot)0(at)gmail(dot)com>, Andreas Karlsson <andreas(at)proxel(dot)se>, Vik Fearing <vik(at)chouppes(dot)com> |
| Subject: | Re: Key joins |
| Date: | 2026-08-02 07:50:49 |
| Message-ID: | YIehqjsPBy_2jrzeuqPBDSda6vlYPJSwh_k8d6N_4K4YdcNzd7USMxBT1bzEtjX6a80VWEilWjhBvU9uK_mgS4ZHXwvJwUBWCq58cafZ6Xw=@protonmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
On Sunday, August 2nd, 2026 at 9:38, Arne Roland <arne(dot)roland(at)malkut(dot)net> wrote:
> Hi hackers,
>
> the attached patch breaks up the stored element of the patch series. The
While FOR KEY makes its way through review, a userspace data point: I generate a pair of set-returning SQL functions per FK — client(document) / client_document_list(profile) — and navigate relations through them:
SELECT d.doc_number, c.name
FROM document d, client(d) c
;
The planner inlines these, so plans are identical to explicit joins; works back to 11.
On the 2021 objections: multiple-FK ambiguity is resolved at name-generation time (role prefixes: client_document_list / manager_document_list), so a new FK renames the affected functions and dependent queries break loudly at compile time instead of silently changing meaning; likewise dropping an FK drops the function.
Not an argument against FOR KEY — syntax in core would be strictly better.
Generator:
https://github.com/asmgit/pg_relation_sql
/ Aleksandr Melnikov
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Andrey Borodin | 2026-08-02 07:55:11 | Re: GiST multirange index scans can fail to return rows |
| Previous Message | David Rowley | 2026-08-02 07:20:01 | Re: [PATCH] Doc: Mention OFF as an alias for EXPLAIN SERIALIZE NONE |