T_CustomScan on ExplainTargetRel

Started by Kouhei Kaigaiabout 11 years ago3 messages
#1Kouhei Kaigai
kaigai@ak.jp.nec.com
1 attachment(s)

Hello,

The attached obvious patch adds T_CustomScan on case-switch of
ExplainTargetRel() that was oversight.

It looked like working, but what it did was just printing referenced
name, instead of table name.

postgres=# explain select ctid, * from t0 hoge where ctid > '(50,0)'::tid;
QUERY PLAN
------------------------------------------------------------------------
Custom Scan (ctidscan) on hoge (cost=0.00..100.00 rows=3333 width=43)
Filter: (ctid > '(50,0)'::tid)
ctid quals: (ctid > '(50,0)'::tid)
(3 rows)

This patch fixes up this behavior, as like other *Scan nodes are doing.

postgres=# explain select ctid, * from t0 hoge where ctid > '(50,0)'::tid;
QUERY PLAN
-------------------------------------------------------------
Seq Scan on t0 hoge (cost=0.00..209.00 rows=3333 width=43)
Filter: (ctid > '(50,0)'::tid)
(2 rows)

Thanks,
--
NEC OSS Promotion Center / PG-Strom Project
KaiGai Kohei <kaigai@ak.jp.nec.com>

Attachments:

pgsql-v9.5-fixup-customscan-on-explain-targetrel.patchapplication/octet-stream; name=pgsql-v9.5-fixup-customscan-on-explain-targetrel.patchDownload
diff --git a/src/backend/commands/explain.c b/src/backend/commands/explain.c
index 99aa0f0..0d54267 100644
--- a/src/backend/commands/explain.c
+++ b/src/backend/commands/explain.c
@@ -2144,6 +2144,7 @@ ExplainTargetRel(Plan *plan, Index rti, ExplainState *es)
 		case T_BitmapHeapScan:
 		case T_TidScan:
 		case T_ForeignScan:
+		case T_CustomScan:
 		case T_ModifyTable:
 			/* Assert it's on a real relation */
 			Assert(rte->rtekind == RTE_RELATION);
#2Kouhei Kaigai
kaigai@ak.jp.nec.com
In reply to: Kouhei Kaigai (#1)
Re: T_CustomScan on ExplainTargetRel

BTW, I published the 'ctidscan' module below as an example of custom-scan.

https://github.com/kaigai/ctidscan

--
NEC OSS Promotion Center / PG-Strom Project
KaiGai Kohei <kaigai@ak.jp.nec.com>

-----Original Message-----
From: pgsql-hackers-owner@postgresql.org
[mailto:pgsql-hackers-owner@postgresql.org] On Behalf Of Kouhei Kaigai
Sent: Thursday, November 20, 2014 3:42 PM
To: pgsql-hackers@postgresql.org
Subject: [HACKERS] T_CustomScan on ExplainTargetRel

Hello,

The attached obvious patch adds T_CustomScan on case-switch of
ExplainTargetRel() that was oversight.

It looked like working, but what it did was just printing referenced name,
instead of table name.

postgres=# explain select ctid, * from t0 hoge where ctid > '(50,0)'::tid;
QUERY PLAN
----------------------------------------------------------------------
--
Custom Scan (ctidscan) on hoge (cost=0.00..100.00 rows=3333 width=43)
Filter: (ctid > '(50,0)'::tid)
ctid quals: (ctid > '(50,0)'::tid)
(3 rows)

This patch fixes up this behavior, as like other *Scan nodes are doing.

postgres=# explain select ctid, * from t0 hoge where ctid > '(50,0)'::tid;
QUERY PLAN
-------------------------------------------------------------
Seq Scan on t0 hoge (cost=0.00..209.00 rows=3333 width=43)
Filter: (ctid > '(50,0)'::tid)
(2 rows)

Thanks,
--
NEC OSS Promotion Center / PG-Strom Project KaiGai Kohei
<kaigai@ak.jp.nec.com>

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

#3Tom Lane
tgl@sss.pgh.pa.us
In reply to: Kouhei Kaigai (#1)
Re: T_CustomScan on ExplainTargetRel

Kouhei Kaigai <kaigai@ak.jp.nec.com> writes:

The attached obvious patch adds T_CustomScan on case-switch of
ExplainTargetRel() that was oversight.

Applied, thanks.

regards, tom lane

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