Re: Recursive CTE and collation - Mailing list pgsql-bugs

From Luca Ferrari
Subject Re: Recursive CTE and collation
Date
Msg-id CAKoxK+7ajThOyQ3q1b2DhxehafRQWHR8t_FBu496XY1qsQ+bJw@mail.gmail.com
Whole thread Raw
In response to Re: Recursive CTE and collation  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-bugs
On Fri, Jun 14, 2019 at 5:19 PM Tom Lane <tgl@sss.pgh.pa.us> wrote:
> I took a closer look at the code to refresh my memory about this,
> and the actual rule for recursive unions is that the output of
> the union has to have the same column types/collations that were
> inferred from the non-recursive (first) side alone.  This is needed
> because when we do parse analysis of the recursive side, those
> types/collations are what we'll assume for any references to the
> recursive union's result.  It's too late to change those decisions
> when we find out what the UNION actually produces.

Thanks for taking time and effort to explain this really interesting
piece of code.

> Obviously there's more than one way you could fix the mismatch, but
> I think that changing the NULL to type "name" is the nicest.

I've fixed the query both on the post and in my repository, thanks.
Thanks also to Sebastien for pointing out my error.

Luca



pgsql-bugs by date:

Previous
From: "David G. Johnston"
Date:
Subject: Re: BUG #15853: DROP TABLE CASCADE drops sequence that other tablesdepend on
Next
From: Alvaro Herrera
Date:
Subject: Re: BUG #15853: DROP TABLE CASCADE drops sequence that other tablesdepend on