Re: Add system column support to the USING clause - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Add system column support to the USING clause
Date
Msg-id 86136.1726239379@sss.pgh.pa.us
Whole thread Raw
Responses Re: Add system column support to the USING clause
List pgsql-hackers
Denis Garsh <d.garsh@arenadata.io> writes:
> The patch adds support for system columns in JOIN USING clause.

I think this is an actively bad idea, and it was likely intentional
that it's not supported today.  A few reasons why:

* There are, fundamentally, no use-cases for joining on system
columns.  The only one that is stable enough to even consider
using for the purpose is tableoid, and I'm not detecting a reason
why that'd be useful.  If there are any edge cases where people
would actually wish to do that, it can be done easily enough with
a standard JOIN ON clause.

* Non-heap table AMs may not provide the same system columns that
heap does, further reducing the scope for plausible use-cases.
(Yeah, I know we don't support that too well today.)

* This breaks ruleutils.c's mechanism for dealing with name
conflicts across multiple USING clauses.  That relies on being
able to assign aliases to the USING inputs at the table level
(that is, "FROM realtable AS aliastable(aliascolumn,...)").
There's no way to alias a system column in the FROM syntax.

            regards, tom lane



pgsql-hackers by date:

Previous
From: Peter Eisentraut
Date:
Subject: Re: tiny step toward threading: reduce dependence on setlocale()
Next
From: Noah Misch
Date:
Subject: Re: [PATCH] pg_stat_activity: make slow/hanging authentication more visible