Re: Case expression pushdown

2021-07-30 Thread Tom Lane
I wrote: > Alexander Pyhalov writes: >> Do we we need to inspect only case_arg_cxt->state? Can we assert that >> collation == case_arg_cxt->collation? > Perhaps, but: > ... Oh, actually there's a third point: the shakiest part of this logic is the assumption that we've correctly matched a CaseT

Re: Case expression pushdown

2021-07-30 Thread Tom Lane
Alexander Pyhalov 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,

Re: Case expression pushdown

2021-07-30 Thread Alexander Pyhalov
Tom Lane писал 2021-07-29 23:54: Alexander Pyhalov 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 col

Re: Case expression pushdown

2021-07-29 Thread Tom Lane
Alexander Pyhalov 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

Re: Case expression pushdown

2021-07-28 Thread Gilles Darold
Le 26/07/2021 à 18:03, Alexander Pyhalov a écrit : Tom Lane писал 2021-07-26 18:18: Alexander Pyhalov writes: [ 0001-Allow-pushing-CASE-expression-to-foreign-server-v6.patch ] This doesn't compile cleanly: deparse.c: In function 'foreign_expr_walker.isra.4': deparse.c:920:8: warning: 'colla

Re: Case expression pushdown

2021-07-26 Thread Alexander Pyhalov
Tom Lane писал 2021-07-26 18:18: Alexander Pyhalov writes: [ 0001-Allow-pushing-CASE-expression-to-foreign-server-v6.patch ] This doesn't compile cleanly: deparse.c: In function 'foreign_expr_walker.isra.4': deparse.c:920:8: warning: 'collation' may be used uninitialized in this function [-W

Re: Case expression pushdown

2021-07-26 Thread Tom Lane
Alexander Pyhalov writes: > [ 0001-Allow-pushing-CASE-expression-to-foreign-server-v6.patch ] This doesn't compile cleanly: deparse.c: In function 'foreign_expr_walker.isra.4': deparse.c:920:8: warning: 'collation' may be used uninitialized in this function [-Wmaybe-uninitialized] if (coll

Re: Case expression pushdown

2021-07-22 Thread Alexander Pyhalov
Tom Lane писал 2021-07-21 19:49: Gilles Darold writes: I'm attaching the v5 patch again as it doesn't appears in the Latest attachment list in the commitfest. So this has a few issues: Hi. 1. In foreign_expr_walker, you're failing to recurse to either the "arg" or "defresult" subtrees of

Re: Case expression pushdown

2021-07-21 Thread Tom Lane
Gilles Darold writes: > I'm attaching the v5 patch again as it doesn't appears in the Latest > attachment list in the commitfest. So this has a few issues: 1. In foreign_expr_walker, you're failing to recurse to either the "arg" or "defresult" subtrees of a CaseExpr, so that it would fail to no

Re: Case expression pushdown

2021-07-07 Thread Gilles Darold
Le 07/07/2021 à 18:55, Gilles Darold a écrit : Le 07/07/2021 à 18:50, Gilles Darold a écrit : Great, I changing the state in the commitfest to "Ready for committers". I'm attaching the v5 patch again as it doesn't appears in the Latest attachment list in the commitfest. And the review su

Re: Case expression pushdown

2021-07-07 Thread Gilles Darold
Le 07/07/2021 à 18:50, Gilles Darold a écrit : Great, I changing the state in the commitfest to "Ready for committers". I'm attaching the v5 patch again as it doesn't appears in the Latest attachment list in the commitfest. -- Gilles Darold MigOps Inc diff --git a/contrib/postgres_fdw/dep

Re: Case expression pushdown

2021-07-07 Thread Gilles Darold
Le 07/07/2021 à 17:39, Alexander Pyhalov a écrit : Hi. Gilles Darold писал 2021-07-07 15:02: Le 22/06/2021 à 15:39, Alexander Pyhalov a écrit : Seino Yuki писал 2021-06-22 16:03: On 2021-06-16 01:29, Alexander Pyhalov wrote: Hi. Ashutosh Bapat писал 2021-06-15 16:24: Looks quite useful to m

Re: Case expression pushdown

2021-07-07 Thread Alexander Pyhalov
Hi. Gilles Darold писал 2021-07-07 15:02: Le 22/06/2021 à 15:39, Alexander Pyhalov a écrit : Seino Yuki писал 2021-06-22 16:03: On 2021-06-16 01:29, Alexander Pyhalov wrote: Hi. Ashutosh Bapat писал 2021-06-15 16:24: Looks quite useful to me. Can you please add this to the next commitfest?

Re: Case expression pushdown

2021-07-07 Thread Gilles Darold
Le 22/06/2021 à 15:39, Alexander Pyhalov a écrit : Seino Yuki писал 2021-06-22 16:03: On 2021-06-16 01:29, Alexander Pyhalov wrote: Hi. Ashutosh Bapat писал 2021-06-15 16:24: Looks quite useful to me. Can you please add this to the next commitfest? Addded to commitfest. Here is an updated

Re: Case expression pushdown

2021-06-22 Thread Alexander Pyhalov
Seino Yuki писал 2021-06-22 16:03: On 2021-06-16 01:29, Alexander Pyhalov wrote: Hi. Ashutosh Bapat писал 2021-06-15 16:24: Looks quite useful to me. Can you please add this to the next commitfest? Addded to commitfest. Here is an updated patch version. Thanks for posting the patch. I ag

Re: Case expression pushdown

2021-06-22 Thread Seino Yuki
On 2021-06-16 01:29, Alexander Pyhalov wrote: Hi. Ashutosh Bapat писал 2021-06-15 16:24: Looks quite useful to me. Can you please add this to the next commitfest? Addded to commitfest. Here is an updated patch version. Thanks for posting the patch. I agree with this content. + Foreign S

Re: Case expression pushdown

2021-06-15 Thread Alexander Pyhalov
Hi. Ashutosh Bapat писал 2021-06-15 16:24: Looks quite useful to me. Can you please add this to the next commitfest? Addded to commitfest. Here is an updated patch version. -- Best regards, Alexander Pyhalov, Postgres ProfessionalFrom 80d60eb9b1630ee55d1825964e0e976ae6c289a1 Mon Sep 17 00:0

Re: Case expression pushdown

2021-06-15 Thread Ashutosh Bapat
Looks quite useful to me. Can you please add this to the next commitfest? On Wed, Jun 9, 2021 at 5:25 PM Alexander Pyhalov wrote: > > Hi. > > This patch allows pushing case expressions to foreign servers, so that > more types of updates could be executed directly. > > For example, without patch:

Case expression pushdown

2021-06-09 Thread Alexander Pyhalov
Hi. This patch allows pushing case expressions to foreign servers, so that more types of updates could be executed directly. For example, without patch: EXPLAIN (VERBOSE, COSTS OFF) UPDATE ft2 d SET c2 = CASE WHEN c2 > 0 THEN c2 ELSE 0 END WHERE c1 > 1000;