Re: Case expression pushdown - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Case expression pushdown
Date
Msg-id 1000762.1627654659@sss.pgh.pa.us
Whole thread Raw
In response to Re: Case expression pushdown  (Alexander Pyhalov <a.pyhalov@postgrespro.ru>)
Responses Re: Case expression pushdown
List pgsql-hackers
Alexander Pyhalov <a.pyhalov@postgrespro.ru> writes:
> The only thing I'm confused about is in T_CaseTestExpr case - how can it 
> be that CaseTestExpr collation doesn't match case_arg_cxt->collation ?
> Do we we need to inspect only case_arg_cxt->state? Can we assert that 
> collation == case_arg_cxt->collation?

Perhaps, but:

(1) I'm disinclined to make this code look different from the otherwise-
identical coding elsewhere in foreign_expr_walker.

(2) That would create a hard assumption that foreign_expr_walker's
conclusions about the collation of a subexpression match those of
assign_query_collations.  I'm not quite sure I believe that (and if
it's true, why aren't we just relying on exprCollation?).  Anyway,
if we're to have an assertion that it's true, it should be in some
place that's a lot less out-of-the-way than CaseTestExpr, because
if the assumption gets violated it might be a long time till we
notice.

So I think we're best off to just write it the way I did, at least
so far as this patch is concerned.  If we want to rethink the way
collation gets calculated here, that would be material for a
separate patch.

            regards, tom lane



pgsql-hackers by date:

Previous
From: Robert Haas
Date:
Subject: Re: Background writer and checkpointer in crash recovery
Next
From: Robert Haas
Date:
Subject: Re: Use generation context to speed up tuplesorts