Re: Targetlist lost when CTE join - Mailing list pgsql-hackers

From Zhang Mingli
Subject Re: Targetlist lost when CTE join
Date
Msg-id 4cefe418-d0d9-4d14-94a9-dff0d26c3d71@Spark
Whole thread Raw
In response to Re: Targetlist lost when CTE join  (Julien Rouhaud <rjuju123@gmail.com>)
List pgsql-hackers
Hi

Regards,
Zhang Mingli
On Jun 28, 2023, 17:17 +0800, Julien Rouhaud <rjuju123@gmail.com>, wrote:
This is working as intended. When using a USING clause you "merge" both
columns so the final target list only contain one version of the merged
columns, which doesn't happen if you use e.g. ON instead. I'm assuming that
what the SQL standard says, but I don't have a copy to confirm.

Thanks. You’r right.
 
Have a test:

gpadmin=# with cte1 as (insert into t2 values (1, 2) returning *) select * from cte1 join t1 on t1.c1 = cte1.c1;
 c1 | c2 | c1 | c2
----+----+----+----
(0 rows)

pgsql-hackers by date:

Previous
From: Julien Rouhaud
Date:
Subject: Re: Targetlist lost when CTE join
Next
From: Julien Rouhaud
Date:
Subject: Re: Targetlist lost when CTE join