pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Dmitry Ivanov <d.ivanov@postgrespro.ru>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Dmitry Ivanov <d.ivanov@postgrespro.ru>
Cc: pgsql-hackers <pgsql-hackers@postgresql.org>
Subject: Re: Possible problem in Custom Scan API
Date: Wed, 12 Apr 2017 19:37:57 +0300
Message-ID: <e9c265ef-3b63-46bd-8b61-8612f684057e@postgrespro.ru> (raw)
In-Reply-To: <8130.1492013026@sss.pgh.pa.us>
References: <e29ddd30-8ef9-4da5-a50b-2bb7b8c7198d@postgrespro.ru>
	<20021.1491933424@sss.pgh.pa.us>
	<1ef85b46-1385-4810-bb80-97cd977da1d5@postgrespro.ru>
	<367.1491940070@sss.pgh.pa.us>
	<f7590622-182b-4362-b148-c21de109ad2a@postgrespro.ru>
	<4509.1491944329@sss.pgh.pa.us>
	<0e0388a6-aa53-42a6-8be9-0d46ccbc788e@postgrespro.ru>
	<8130.1492013026@sss.pgh.pa.us>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-hackers>

Tom Lane wrote:
> I'm coming around to the idea that it'd be better to disable physical
> tlists for custom scans.

I've been thinking about this all along, and it seems that this is a decent 
decision. However, I've made a tiny bugfix patch which allows CustomScans 
to notify the core code that they can handle physical targetlists. 
Extension authors won't have to change anything provided that CustomPath is 
allocated using palloc0().

> However, I'm hesitant to make such a change in the back branches; if
> there's anyone using custom scans who's negatively affected, they'd be
> rightfully unhappy.  Are you satisfied if we change this in HEAD?

It's kind of bittersweet. I'm really glad that you've changed your mind and 
this is going to be fixed in HEAD, but this change is crucial for our 
extension (if we use it with vanilla postgres).

Maybe you'll like my patch more.


-- 
Dmitry Ivanov
Postgres Professional: http://www.postgrespro.com
Russian Postgres Company=

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Attachments:

customscan_physical_tlist_fix.diff (text/x-patch, 1.0K) download diff --git a/src/backend/optimizer/plan/createplan.c b/src/backend/optimizer/plan/createplan.c index 71678d08dc..4b0322530b 100644 --- a/src/backend/optimizer/plan/createplan.c +++ b/src/backend/optimizer/plan/createplan.c @@ -761,6 +761,9 @@ use_physical_tlist(PlannerInfo *root, Path *path, int flags) if (rel->reloptkind != RELOPT_BASEREL) return false; + if (IsA(path, CustomPath) && ((CustomPath *) path)->forbid_physical_tlist) + return false; + /* * Can't do it if any system columns or whole-row Vars are requested. * (This could possibly be fixed but would take some fragile assumptions diff --git a/src/include/nodes/relation.h b/src/include/nodes/relation.h index 48862d93ae..5a1f6cee47 100644 --- a/src/include/nodes/relation.h +++ b/src/include/nodes/relation.h @@ -1089,6 +1089,7 @@ typedef struct CustomPath * nodes/extensible.h */ List *custom_paths; /* list of child Path nodes, if any */ List *custom_private; + bool forbid_physical_tlist; const struct CustomPathMethods *methods; } CustomPath;

view thread (12+ messages)  latest in thread

Message-ID: <e9c265ef-3b63-46bd-8b61-8612f684057e@postgrespro.ru>
Permalink:  ../e9c265ef-3b63-46bd-8b61-8612f684057e@postgrespro.ru/
Also on:    postgresql.org/message-id/e9c265ef-3b63-46bd-8b61-8612f684057e@postgrespro.ru

 ·  · 

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 using the --to and --cc options:
  reply via email

  To: pgsql-hackers@postgresql.org
  Cc: d.ivanov@postgrespro.ru, tgl@sss.pgh.pa.us
  Subject: Re: Possible problem in Custom Scan API
  In-Reply-To: <e9c265ef-3b63-46bd-8b61-8612f684057e@postgrespro.ru>

* 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