pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Amit Langote <amitlangote09@gmail.com>
Cc: Andrey Lepikhov <a.lepikhov@postgrespro.ru>
Cc: Alexander Pyhalov <a.pyhalov@postgrespro.ru>
Cc: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Subject: Re: join pushdown and issue with foreign update
Date: Fri, 04 Jun 2021 19:23:04 -0400
Message-ID: <451345.1622848984@sss.pgh.pa.us> (raw)
In-Reply-To: <CA+HiwqFKLFQoDB4kBhbexh08dfRoFvhQme6Yxw=hhmN6ECn8gg@mail.gmail.com>
References: <7817fb9ebd6661cdf9b67dec6e129a78@postgrespro.ru>
	<ae6d414df6165d50ec9db4265f999c14@postgrespro.ru>
	<CA+HiwqHnLESTUQUQ3-MBxOatPK4P4uu2Br3+6KRxFfbBO=HgFw@mail.gmail.com>
	<050b90460c024dd21af53dbaaf8fd510@postgrespro.ru>
	<2845636.1622571541@sss.pgh.pa.us>
	<2854976.1622583171@sss.pgh.pa.us>
	<f0e58ebd-e5e6-e905-f3ab-a609272e6f08@postgrespro.ru>
	<CA+HiwqFKLFQoDB4kBhbexh08dfRoFvhQme6Yxw=hhmN6ECn8gg@mail.gmail.com>

Amit Langote <amitlangote09@gmail.com> writes:
> On Wed, Jun 2, 2021 at 4:39 PM Andrey Lepikhov
> <a.lepikhov@postgrespro.ru> wrote:
>> I played with your patch and couldn't find any errors. But what if ROW
>> operation were allowed to be pushed to a foreign server?
>> Potentially, I can imagine pushed-down JOIN with arbitrary ROW function
>> in its target list.

I thought about this for awhile and I don't think it's a real concern.
There's nothing stopping us from pushing an expression of the form
"func(row(...))" or "row(...) op row(...)", because we're not asking
to retrieve the value of the ROW() expression.  Whether the remote
server can handle that is strictly its concern.  (Probably, it's
going to do something involving a locally-assigned typmod to keep
track of the rowtype, but it's not our problem.)  Where things get
sticky is if we try to *retrieve the value* of a ROW() expression.
And except in this specific context, I don't see why we'd do that.
There's no advantage compared to retrieving the component Vars
or expressions.

> ... I wonder if it would make sense to also
> check varattno == 0 here somewhere for good measure.

Yeah, I considered doing that but left it off in this version.
It's not clear to me how there could be a table column of type RECORD,
so it seemed unnecessary.  On the other hand, it's also cheap
insurance, so I'll put it back.

			regards, tom lane





view thread (13+ messages)

Message-ID: <451345.1622848984@sss.pgh.pa.us>
Permalink:  ../451345.1622848984@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/451345.1622848984@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-hackers@postgresql.org
  Cc: tgl@sss.pgh.pa.us, amitlangote09@gmail.com, a.lepikhov@postgrespro.ru, a.pyhalov@postgrespro.ru
  Subject: Re: join pushdown and issue with foreign update
  In-Reply-To: <451345.1622848984@sss.pgh.pa.us>
  References: <7817fb9ebd6661cdf9b67dec6e129a78@postgrespro.ru> <ae6d414df6165d50ec9db4265f999c14@postgrespro.ru> <CA+HiwqHnLESTUQUQ3-MBxOatPK4P4uu2Br3+6KRxFfbBO=HgFw@mail.gmail.com> <050b90460c024dd21af53dbaaf8fd510@postgrespro.ru> <2845636.1622571541@sss.pgh.pa.us> <2854976.1622583171@sss.pgh.pa.us> <f0e58ebd-e5e6-e905-f3ab-a609272e6f08@postgrespro.ru> <CA+HiwqFKLFQoDB4kBhbexh08dfRoFvhQme6Yxw=hhmN6ECn8gg@mail.gmail.com> <451345.1622848984@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox