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 2cd5681d-3b5d-420d-8b6e-b88802038921@www.fastmail.com
Whole thread Raw
In response to Re: Idea: Avoid JOINs by using path expressions to follow FKs  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
On Sun, Mar 28, 2021, at 16:04, Tom Lane wrote:
Andrew Dunstan <andrew@dunslane.net> writes:
> Maybe. I don't recall ever having seen a column with more than one FK.
> Is that a common thing? In itself it seems like a bad idea.

Yeah, that aspect seems like a complete show-stopper.  We have a way
to enforce that you can't *drop* a constraint that some stored view
depends on for semantic validity.  We don't have a way to say that
you can't *add* a constraint-with-certain-properties.  And I don't
think it'd be very practical to do (consider race conditions, if
nothing more).

Thanks for valuable insights, I didn't think about these things.

What if the path expressions are just syntactic sugar for an INNER JOIN on the referencing -> referenced column?
If a VIEW is created using this syntax, it would be stored as INNER JOINs, similar to how SELECT * is expanded.

/Joel

pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Idea: Avoid JOINs by using path expressions to follow FKs
Next
From: Andrew Dunstan
Date:
Subject: Re: Idea: Avoid JOINs by using path expressions to follow FKs