Re: Odd system-column handling in postgres_fdw join pushdown patch

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Ashutosh Bapat <ashutosh(dot)bapat(at)enterprisedb(dot)com>
Cc: Etsuro Fujita <fujita(dot)etsuro(at)lab(dot)ntt(dot)co(dot)jp>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Odd system-column handling in postgres_fdw join pushdown patch
Date: 2016-04-13 18:36:14
Message-ID: CA+TgmoZFcCBXWfSaGQAbOXCy1kYpGEdM_tuS+YvhEnBZ9RG2DA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Apr 13, 2016 at 2:11 PM, Robert Haas <robertmhaas(at)gmail(dot)com> wrote:
> So, clearly that's not good. It should at least be consistent. But
> more than that, the fact that postgres_fdw sets the xmax to 0xffffffff
> is also pretty wacky. We might use such a value as a sentinel for
> some data type, but for transaction IDs that's just some random normal
> transaction ID, and it's NOT coming from t1. I haven't tracked down
> where it *is* coming from yet, but can't imagine it's any place very
> principled.

And, yeah, it's not very principled.

rhaas=# select ft1.xmin, ft1.xmax, ft1.cmin from ft1;
xmin | xmax | cmin
------+------------+-------
96 | 4294967295 | 16392
96 | 4294967295 | 16392
96 | 4294967295 | 16392
96 | 4294967295 | 16392
(4 rows)

What's happening here is that heap_getattr() is being applied to a
HeapTupleHeaderData which contains DatumTupleFields. So 96 is
datum_len_, 4294967295 is the -1 recorded in datum_typmod, and 16392
is the compose type OID recorded in datum_typeid, which happens in
this case to be the OID of ft1. Isn't that special?

It's hard for me to view this as anything other than a bug in
postgres_fdw - which of course means that this open item boils down to
the complaint that the way system columns are handled by join pushdown
isn't bug-compatible with the existing behavior....

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Daniel Lenski 2016-04-13 18:36:21 sign function with INTERVAL?
Previous Message Tom Lane 2016-04-13 18:34:22 Re: Odd system-column handling in postgres_fdw join pushdown patch