From: | Ashutosh Bapat <ashutosh(dot)bapat(dot)oss(at)gmail(dot)com> |
---|---|
To: | emre(at)hasegeli(dot)com, Ashutosh Bapat <ashutosh(dot)bapat(at)enterprisedb(dot)com> |
Cc: | pgsql-hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: postgres_fdw: Handle boolean comparison predicates |
Date: | 2021-05-31 12:08:11 |
Message-ID: | CAExHW5tFOphpmHebhGjPxKh3JNyspBwfmK9p=ovrC3D0TPFu2A@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Hi Emre,
This looks like a good improvement.
Please add this patch to the commitfest so that it's not forgotten. It
will be considered as a new feature so will be considered for commit
after the next commitfest.
Mean time here are some comments.
+/*
+ * Deparse IS [NOT] TRUE/FALSE/UNKNOWN expression.
+ */
+static void
+deparseBooleanTest(BooleanTest *node, deparse_expr_cxt *context)
+{
+ StringInfo buf = context->buf;
+
+ switch (node->booltesttype)
+ {
+ case IS_NOT_TRUE:
+ appendStringInfoString(buf, "(NOT ");
+ deparseExpr(node->arg, context);
+ appendStringInfoString(buf, " OR ");
+ deparseExpr(node->arg, context);
+ appendStringInfoString(buf, " IS NULL)");
+ break;
+}
I don't understand why we need to complicate the expressions when
sending those to the foreign nodes. Why do we want to send (xyz IS
FALSE) (NOT (xyz) OR (xyz IS NULL)) and not as just (xyz IS FALSE).
The latter is much more readable and less error-prone. That true for
all the BooleanTest deparsing.
+EXPLAIN (VERBOSE, COSTS OFF) SELECT * FROM ft1 t1 WHERE (c1 = 100) IS
TRUE; -- BooleanTest
Also test a boolean column?
On Mon, May 31, 2021 at 1:33 PM Emre Hasegeli <emre(at)hasegeli(dot)com> wrote:
>
> The comparison predicates IS [NOT] TRUE/FALSE/UNKNOWN were not
> recognised by postgres_fdw, so they were not pushed down to the remote
> server. The attached patch adds support for them.
>
> I am adding this to the commitfest 2021-07.
--
Best Wishes,
Ashutosh Bapat
From | Date | Subject | |
---|---|---|---|
Next Message | Michael Paquier | 2021-05-31 12:37:17 | Re: Incorrect snapshots while promoting hot standby node when 2PC is used |
Previous Message | Amit Kapila | 2021-05-31 11:40:50 | Re: Skipping logical replication transactions on subscriber side |