Re: Recursive CTE and collation

From: Luca Ferrari <fluca1978(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Sébastien Lardière <sebastien(at)lardiere(dot)net>, pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: Recursive CTE and collation
Date: 2019-06-15 12:03:41
Message-ID: CAKoxK+7ajThOyQ3q1b2DhxehafRQWHR8t_FBu496XY1qsQ+bJw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Fri, Jun 14, 2019 at 5:19 PM Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)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

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Alvaro Herrera 2019-06-15 16:13:58 Re: BUG #15853: DROP TABLE CASCADE drops sequence that other tables depend on
Previous Message David G. Johnston 2019-06-15 11:35:49 Re: BUG #15853: DROP TABLE CASCADE drops sequence that other tables depend on