Re: Idea: Avoid JOINs by using path expressions to follow FKs

Joel Jacobson <joel@compiler.org>

From: "Joel Jacobson" <joel@compiler.org>
To: "Tom Lane" <tgl@sss.pgh.pa.us>, "Andrew Dunstan" <andrew@dunslane.net>
Cc: "Alvaro Herrera" <alvherre@alvh.no-ip.org>, pgsql-hackers@lists.postgresql.org
Date: 2021-03-28T14:39:39Z
Lists: pgsql-hackers
On Sun, Mar 28, 2021, at 16:04, Tom Lane wrote:
> Andrew Dunstan <andrew@dunslane.net <mailto:andrew%40dunslane.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

Commits

  1. Clean up generation of default names for constraints, indexes, and serial