Re: Push down time-related SQLValue functions to foreign server

From: Ranier Vilela <ranier(dot)vf(at)gmail(dot)com>
To: Alexander Pyhalov <a(dot)pyhalov(at)postgrespro(dot)ru>
Cc: Zhihong Yu <zyu(at)yugabyte(dot)com>, Pgsql Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Push down time-related SQLValue functions to foreign server
Date: 2021-08-20 11:19:37
Message-ID: CAEudQAqdvioDMpcJtx7byq6GDZ14bpMc-8J339BMGLbfUCCspQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Em sex., 20 de ago. de 2021 às 04:13, Alexander Pyhalov <
a(dot)pyhalov(at)postgrespro(dot)ru> escreveu:

> Hi.
>
> Ranier Vilela писал 2021-08-19 14:01:
> > Em qui., 19 de ago. de 2021 às 07:50, Zhihong Yu <zyu(at)yugabyte(dot)com>
> >> Hi,
> >> For 0001 patch:
> >>
> >> + if ((s->op != SVFOP_CURRENT_TIMESTAMP) &&
> >> + (s->op != SVFOP_CURRENT_TIMESTAMP_N) &&
> >> + (s->op != SVFOP_CURRENT_TIME) &&
> >> ...
> >>
> >> The above check appears more than once. If extracted into a helper
> >> method, it would help reduce duplicate and make the code more
> >> readable.
> >
> > Perhaps in a MACRO?
>
> Changed this check to a macro, also fixed condition in
> is_foreign_param() and added test for it.
> Also fixed comment in prepare_query_params().
>
Thanks.

Another question:
For 0002 patch:

+ if (node->funcid == F_NOW)
+ {
+ SQLValueFunction *svf = makeNode(SQLValueFunction);
+
+ svf->op = SVFOP_CURRENT_TIMESTAMP;
+ svf->type = TIMESTAMPTZOID;
+ svf->typmod = -1;
+ svf->location = -1;
+
+ deparseSQLValueFunction(svf, context);
+
+ return;
+ }
It seems to me that the svf->xpr field ( SQLValueFunction *svf ) is not
initialized somewhere even by deparseSQLValueFunction.
If it's not really used, it should be initialized to NULL, ok?

regards,
Ranier Vilela

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Eisentraut 2021-08-20 11:28:10 Re: psql - add SHOW_ALL_RESULTS option
Previous Message Fujii Masao 2021-08-20 10:36:02 Re: Some leftovers of recent message cleanup?