Re: Case expression pushdown

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

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

Attachment Content-Type Size
0001-Allow-pushing-CASE-expression-to-foreign-server-v8.patch text/x-diff 18.6 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2021-07-29 21:01:24 Re: pg_upgrade does not upgrade pg_stat_statements properly
Previous Message David G. Johnston 2021-07-29 19:56:46 Re: pg_upgrade does not upgrade pg_stat_statements properly