public inbox for [email protected]  
help / color / mirror / Atom feed
From: Peter Eisentraut <[email protected]>
To: Ashutosh Bapat <[email protected]>
To: SATYANARAYANA NARLAPURAM <[email protected]>
Cc: Junwang Zhao <[email protected]>
Cc: PostgreSQL Hackers <[email protected]>
Subject: Re: [PATCH] Resolve unknown-type literals in GRAPH_TABLE COLUMNS
Date: Mon, 4 May 2026 17:12:02 +0200
Message-ID: <[email protected]> (raw)
In-Reply-To: <CAExHW5vmmAS6Vroh8W9+vmuM2ReocODRCWPqYozGSyhxCxxL+Q@mail.gmail.com>
References: <CAHg+QDcyKNWyzDoKMxiZNjv7C-wAxs8y0ZoNkOV137Y+nk3UXg@mail.gmail.com>
	<CAEG8a3KTP1sX+RbPFNST4kHdeRZQR5-dd6kEihV56=K5irrhyQ@mail.gmail.com>
	<CAHg+QDdzUMW4qQmywiPmVo2z3+HccFZL+mujdXbB+ghU21u7dA@mail.gmail.com>
	<CAExHW5vmmAS6Vroh8W9+vmuM2ReocODRCWPqYozGSyhxCxxL+Q@mail.gmail.com>

On 29.04.26 16:09, Ashutosh Bapat wrote:
> On Mon, Apr 27, 2026 at 11:34 AM SATYANARAYANA NARLAPURAM
> <[email protected]> wrote:
>>
>> Hi,
>>
>> On Sun, Apr 26, 2026 at 8:10 AM Junwang Zhao <[email protected]> wrote:
>>>
>>> Hi SATYANARAYANA,
>>>
>>> On Sun, Apr 26, 2026 at 3:53 AM SATYANARAYANA NARLAPURAM
>>> <[email protected]> wrote:
>>>>
>>>> Hi hackers,
>>>>
>>>> transformRangeGraphTable() calls transformExpr() and
>>>> assign_list_collations() for COLUMNS expressions but missed calling
>>>> resolveTargetListUnknowns(). As a result, literals such as 'val1'
>>>> in a COLUMNS clause retained type "unknown", causing failures with
>>>> ORDER BY, UNION, and output conversions.
>>>>
>>>> Fix by calling resolveTargetListUnknowns() on the columns target
>>>> list right after assign_list_collations(), similar to SELECT target lists in
>>>> transformSelectStmt().
>>>>
>>>> Attached a patch to fix this, which also includes test cases to reproduce.
>>>
>>> I can reproduce this and the patch fixes it.
>>>
>>> One question: why is resolveTargetListUnknowns called after
>>> assign_list_collations?
>>>
>>> I'm asking because in transformSelectStmt, resolveTargetListUnknowns
>>> is invoked before assign_query_collations. It might not matter, but keeping
>>> the order consistent would be good for readers.
>>
>>
>> Updated the patch. It should be before.
> 
> Do we really need a test for ORDER BY on a literal column? I replaced
> all the test queries with a single one which covers all the scenarios
> covered by those queries.
> 
> The patch needed to consider pstate->p_resolve_unknowns. Unknown
> literals are not resolved as text always. See the test query.

I couldn't find a commit to apply this patch cleanly (the subject says 
patch 5/5, so maybe you had some unpublished local changes?).  After 
applying the test case manually, it looks like the test output is 
already correct without the code change.  So if this patch is still 
required, we need a better test case.






view thread (6+ messages)  latest in thread

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected], [email protected], [email protected], [email protected]
  Subject: Re: [PATCH] Resolve unknown-type literals in GRAPH_TABLE COLUMNS
  In-Reply-To: <[email protected]>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox