Re: Idea: Avoid JOINs by using path expressions to follow FKs - Mailing list pgsql-hackers

From Joel Jacobson
Subject Re: Idea: Avoid JOINs by using path expressions to follow FKs
Date
Msg-id 7210fae8-9596-4796-a5eb-f42948229ad6@www.fastmail.com
Whole thread Raw
In response to Re: Idea: Avoid JOINs by using path expressions to follow FKs  (Vik Fearing <vik@postgresfriends.org>)
Responses Re: Idea: Avoid JOINs by using path expressions to follow FKs  (Vik Fearing <vik@postgresfriends.org>)
List pgsql-hackers
On Mon, Mar 29, 2021, at 16:17, Vik Fearing wrote:
CREATE TABLE order_details (
    "order" REF(orders),
    product REF(products),
    quantity integer,
    PRIMARY KEY ("order", product)
);


And the query would be:

SELECT DISTINCT order_details."order"->customer->company_name
FROM order_details
WHERE order_details.product->product_name = 'Chocolade';


Postgres already supports most of that, but not all of it.

Do you know if REF is meant to be a replacement for foreign keys?

Are they a different thing meant to co-exist with foreign keys,
or are they actually foreign keys "under the hood"
or something else entirely?

/Joel

pgsql-hackers by date:

Previous
From: Fujii Masao
Date:
Subject: Re: TRUNCATE on foreign table
Next
From: Cary Huang
Date:
Subject: Re: [PATCH] Add --create-only option to pg_dump/pg_dumpall