From: | Robert Haas <robertmhaas(at)gmail(dot)com> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | Peter Eisentraut <peter(at)eisentraut(dot)org>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: magical eref alias names |
Date: | 2025-01-03 13:44:22 |
Message-ID: | CA+Tgmoa14DZKU0pSrVFP9PkBZx45OF9kgr4g_WOZDh=dLj6r+w@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Thu, Jan 2, 2025 at 5:11 PM Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> Okay, but then we still have the problem of how to ensure that in
> a query that has inline'd some views. I think solving the sort of
> I-want-to-reference-this problem you describe would require
> that we unique-ify the aliases in the rewriter, just after it
> finishes incorporating any views. We could do that, but it seems
> like a lot of cycles to expend on something that would be pointless
> in the typical case where nobody ever looks at the aliases later.
Right, plus if you care about function-inlining or
inheritance-expansion, those happen even later, at planning time.
> > My original
> > proposal of getting rid of system-generated fake names isn't
> > necessary, because you very helpfully pointed out that I can look at
> > whether RTE->alias->aliasname exists to figure that out.
>
> Actually, I noticed that we are failing to honor that in the places
> where we inject "*SELECT*" and "*SELECT* %d" names, because that
> code puts those names into RTE->alias not only RTE->eref.
> I experimented with the attached patch to not do that anymore,
> which is sort of a subset of what you did but just focused on
> not lying about what's generated versus user-written. We could
> alternatively keep the current generated names by extending
> addRangeTableEntryForSubquery's API so that alias and generated eref
> are passed separately. (I didn't look to see if anyplace else
> is messing up this distinction similarly.)
Hmm, I definitely like not lying about what is generated vs. what is
user-written. I don't have a strong opinion right now on the best way
of accomplishing that.
--
Robert Haas
EDB: http://www.enterprisedb.com
From | Date | Subject | |
---|---|---|---|
Next Message | Ilia Evdokimov | 2025-01-03 13:45:21 | Re: Define STATS_MIN_ROWS for minimum rows of stats in ANALYZE |
Previous Message | PG Doc comments form | 2025-01-03 13:39:44 | Parameter NOT NULL to CREATE DOMAIN not the same as CHECK (VALUE IS NOT NULL) |