Content-Length: 295804 | pFad | http://github.com/postgrespro/postgres_cluster/commit/9e9c38e15947f4f3ed478f8b70e74b55e31fe950

3D postgres_fdw: Fix incorrect NULL handling in join pushdown. · postgrespro/postgres_cluster@9e9c38e · GitHub
Skip to content

Commit 9e9c38e

Browse files
committed
postgres_fdw: Fix incorrect NULL handling in join pushdown.
something.* IS NOT NULL means that every attribute of the row is not NULL, not that the row itself is non-NULL (e.g. because it's coming from below an outer join. Use (somevar.*)::pg_catalog.text IS NOT NULL instead. Ashutosh Bapat, per a report by Rushabh Lathia. Reviewed by Amit Langote and Etsuro Fujita. Schema-qualification added by me.
1 parent 267569b commit 9e9c38e

File tree

3 files changed

+50
-25
lines changed

3 files changed

+50
-25
lines changed

contrib/postgres_fdw/deparse.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1599,9 +1599,9 @@ deparseColumnRef(StringInfo buf, int varno, int varattno, PlannerInfo *root,
15991599

16001600
if (qualify_col)
16011601
{
1602-
appendStringInfoString(buf, "CASE WHEN ");
1602+
appendStringInfoString(buf, "CASE WHEN (");
16031603
ADD_REL_QUALIFIER(buf, varno);
1604-
appendStringInfo(buf, "* IS NOT NULL THEN %u END", fetchval);
1604+
appendStringInfo(buf, "*)::pg_catalog.text IS NOT NULL THEN %u END", fetchval);
16051605
}
16061606
else
16071607
appendStringInfo(buf, "%u", fetchval);
@@ -1643,9 +1643,9 @@ deparseColumnRef(StringInfo buf, int varno, int varattno, PlannerInfo *root,
16431643
*/
16441644
if (qualify_col)
16451645
{
1646-
appendStringInfoString(buf, "CASE WHEN ");
1646+
appendStringInfoString(buf, "CASE WHEN (");
16471647
ADD_REL_QUALIFIER(buf, varno);
1648-
appendStringInfo(buf, "* IS NOT NULL THEN ");
1648+
appendStringInfo(buf, "*)::pg_catalog.text IS NOT NULL THEN ");
16491649
}
16501650

16511651
appendStringInfoString(buf, "ROW(");

0 commit comments

Comments
 (0)








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/postgrespro/postgres_cluster/commit/9e9c38e15947f4f3ed478f8b70e74b55e31fe950

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy