Re: [PATCH] Resolve unknown-type literals in GRAPH_TABLE COLUMNS

Junwang Zhao <zhjwpku@gmail.com>

From: Junwang Zhao <zhjwpku@gmail.com>
To: SATYANARAYANA NARLAPURAM <satyanarlapuram@gmail.com>
Cc: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>, Ashutosh Bapat <ashutosh.bapat.oss@gmail.com>
Date: 2026-04-26T15:10:24Z
Lists: pgsql-hackers
Hi SATYANARAYANA,

On Sun, Apr 26, 2026 at 3:53 AM SATYANARAYANA NARLAPURAM
<satyanarlapuram@gmail.com> 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.

>
>
> Thanks,
> Satya
>
>


-- 
Regards
Junwang Zhao



Commits

Same data as JSON: GET /api/v1/messages/:b64id/commits the thread's linked commits as JSON, with link sources. API reference →
  1. Resolve unknown-type literals in GRAPH_TABLE COLUMNS