Re: Case expression pushdown

From: Alexander Pyhalov <a(dot)pyhalov(at)postgrespro(dot)ru>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Gilles Darold <gilles(at)migops(dot)com>, pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: Case expression pushdown
Date: 2021-07-30 08:16:53
Message-ID: 552b2bcdf79d674ce9606b0ffddd829c@postgrespro.ru
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Tom Lane писал 2021-07-29 23:54:
> Alexander Pyhalov <a(dot)pyhalov(at)postgrespro(dot)ru> writes:
>> [ 0001-Allow-pushing-CASE-expression-to-foreign-server-v7.patch ]
>
> I looked this over. It's better than before, but the collation
> handling is still not at all correct. We have to consider that a
> CASE's arg expression supplies the collation for a contained
> CaseTestExpr, otherwise we'll come to the wrong conclusions about
> whether "CASE foreignvar WHEN ..." is shippable, if the foreignvar
> is what's determining collation of the comparisons.
>
> This means that the CaseExpr level of recursion has to pass data down
> to the CaseTestExpr level. In the attached, I did that by adding an
> additional argument to foreign_expr_walker(). That's a bit invasive,
> but it's not awful. I thought about instead adding fields to the
> foreign_loc_cxt struct. But that seemed considerably messier in the
> end, because we'd then have some fields that are information sourced
> at one recursion level and some that are info sourced at another
> level.
>
> I also whacked the regression test cases around a lot. They seemed
> to spend a lot of time on irrelevant combinations, while failing to
> check the things that matter, namely whether collation-based pushdown
> decisions are made correctly.
>
> regards, tom lane

Hi.

Overall looks good.
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?

--
Best regards,
Alexander Pyhalov,
Postgres Professional

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message tanghy.fnst@fujitsu.com 2021-07-30 08:25:37 RE: [HACKERS] logical decoding of two-phase transactions
Previous Message Geoff Winkless 2021-07-30 08:05:53 Re: Replace l337sp34k in comments.