Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1wJuxy-000PhK-1a for pgsql-hackers@arkaria.postgresql.org; Mon, 04 May 2026 15:12:14 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1wJuxw-007psU-0B for pgsql-hackers@arkaria.postgresql.org; Mon, 04 May 2026 15:12:12 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1wJuxv-007psM-0s for pgsql-hackers@lists.postgresql.org; Mon, 04 May 2026 15:12:11 +0000 Received: from fout-b4-smtp.messagingengine.com ([202.12.124.147]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1wJuxr-00000000TBD-3xZP for pgsql-hackers@lists.postgresql.org; Mon, 04 May 2026 15:12:11 +0000 Received: from phl-compute-01.internal (phl-compute-01.internal [10.202.2.41]) by mailfout.stl.internal (Postfix) with ESMTP id 0B3261D00100; Mon, 4 May 2026 11:12:05 -0400 (EDT) Received: from phl-frontend-03 ([10.202.2.162]) by phl-compute-01.internal (MEProxy); Mon, 04 May 2026 11:12:05 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=eisentraut.org; h=cc:cc:content-transfer-encoding:content-type:content-type :date:date:from:from:in-reply-to:in-reply-to:message-id :mime-version:references:reply-to:subject:subject:to:to; s=fm2; t=1777907524; x=1777993924; bh=lJnjWp8WVB6TPoYwQcX+FSyFX9yBZVDB oWdY1iKvJIs=; b=AuGM6m0+L0bMAfXfG/9iHc1UECvvFjEbLn5LZpAdsKd3IWUX neSfzZBJ8SuhdjiDvSkBSoq5XjeQhrKZbmuwPp5KnZ0ar3dKEvWfEWLfM1zNNqms m12AB6XTJtaVCZUe7fOvkcInkMjVXjbtI/TCgIfpdkl7fe1NWXR1z5R5iebkTnnR 06di2Kh/Yfq8QHTxcVOWR1FVSNFjutTi0/nNMP3nj4+OByIE1DEM1jHPSchlLmjM 1gqYUogdnNH5lOfgQOHjJlyPz+42BG5A48Nc4jbvkmOHShDgbm6QQQMd+BDxdpvP zOKekRBPQIgfb8UjYUtRsQIbrVHUnIdlISHdCg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t=1777907524; x= 1777993924; bh=lJnjWp8WVB6TPoYwQcX+FSyFX9yBZVDBoWdY1iKvJIs=; b=P m600O0ZTFayAlhFsOMzwhLoeySFFheTXZaUGPdp9k7y7sboqkoaQIqoNcOEwoPkj jyjmmceZRhxktY8RsMEClO4OePOnW2ngb0zlvLcSl0/q0lRecvzOJ1kHPo4ZisjA jJAFgfIUF1uLXY2sg6Ke4gFv0pPYLTwnb39Ny8BKwk3fMJD1GT6ISbX5WJIVV4jt VF+JDqPBCjCUcN4y7ogYKdlxYygFoXkBqWkTN5xctI57hhtqWruZ6ol12g0hAw6U PeBRk/s2isW+xlSwtjjgGWkBGTzJut1g7rSG3UpT+MHZuAiVbzgZ+xfE5xJmVFNj SN7kr6bR3YIXyYFXjw/Sw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefhedrtddtgdelleduiecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpuffrtefokffrpgfnqfghnecuuegr ihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjug hrpefkffggfgfuvfevfhfhjggtgfesthekredttddvjeenucfhrhhomheprfgvthgvrhcu gfhishgvnhhtrhgruhhtuceophgvthgvrhesvghishgvnhhtrhgruhhtrdhorhhgqeenuc ggtffrrghtthgvrhhnpeejhfevhedttefgfffhhfeffefggffhffelgfeiueeukeehvdeh vdefheffvdefueenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfh hrohhmpehpvghtvghrsegvihhsvghnthhrrghuthdrohhrghdpnhgspghrtghpthhtohep gedpmhhouggvpehsmhhtphhouhhtpdhrtghpthhtoheprghshhhuthhoshhhrdgsrghprg htrdhoshhssehgmhgrihhlrdgtohhmpdhrtghpthhtohepshgrthihrghnrghrlhgrphhu rhgrmhesghhmrghilhdrtghomhdprhgtphhtthhopeiihhhjfihpkhhusehgmhgrihhlrd gtohhmpdhrtghpthhtohepphhgshhqlhdqhhgrtghkvghrsheslhhishhtshdrphhoshht ghhrvghsqhhlrdhorhhg X-ME-Proxy: Feedback-ID: ie0a040ee:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 4 May 2026 11:12:03 -0400 (EDT) Message-ID: <2b3490b5-e0e5-4f3b-9165-df1990bee70b@eisentraut.org> Date: Mon, 4 May 2026 17:12:02 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] Resolve unknown-type literals in GRAPH_TABLE COLUMNS To: Ashutosh Bapat , SATYANARAYANA NARLAPURAM Cc: Junwang Zhao , PostgreSQL Hackers References: Content-Language: en-US From: Peter Eisentraut In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 29.04.26 16:09, Ashutosh Bapat wrote: > On Mon, Apr 27, 2026 at 11:34 AM SATYANARAYANA NARLAPURAM > wrote: >> >> Hi, >> >> On Sun, Apr 26, 2026 at 8:10 AM Junwang Zhao wrote: >>> >>> Hi SATYANARAYANA, >>> >>> On Sun, Apr 26, 2026 at 3:53 AM SATYANARAYANA NARLAPURAM >>> 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.