pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Andrey Lepikhov <a.lepikhov@postgrespro.ru>
To: PostgreSQL mailing lists <pgsql-bugs@lists.postgresql.org>
To: David Rowley <dgrowleyml@gmail.com>
Subject: Missed TidRangePath in the print_path switch
Date: Thu, 28 Sep 2023 12:07:48 +0700
Message-ID: <379082d6-1b6a-4cd6-9ecf-7157d8c08635@postgrespro.ru> (raw)

Hi,

The TidRangePath node was introduced three years ago. However, path 
printing machinery still does not support it. It isn't enjoyable to add 
this string of code each time. I suggest adding it now.
Also, I propose not printing "???path" in the default case but throwing 
a warning - see the patch in the attachment. It can help to avoid such 
slip-ups next time.
It generally makes sense to generate such long switches automatically, 
likewise nodeToString.

-- 
regards,
Andrey Lepikhov
Postgres Professional
diff --git a/src/backend/optimizer/path/allpaths.c b/src/backend/optimizer/path/allpaths.c
index 9bdc70c702..b0ed69d2f8 100644
--- a/src/backend/optimizer/path/allpaths.c
+++ b/src/backend/optimizer/path/allpaths.c
@@ -4470,6 +4470,9 @@ print_path(PlannerInfo *root, Path *path, int indent)
 		case T_TidPath:
 			ptype = "TidScan";
 			break;
+		case T_TidRangePath:
+			ptype = "TidRangePath";
+			break;
 		case T_SubqueryScanPath:
 			ptype = "SubqueryScan";
 			break;
@@ -4578,7 +4581,8 @@ print_path(PlannerInfo *root, Path *path, int indent)
 			subpath = ((LimitPath *) path)->subpath;
 			break;
 		default:
-			ptype = "???Path";
+			elog(WARNING, "could not print unrecognized node type: %d",
+				 (int) nodeTag(path));
 			break;
 	}
 


Attachments:

  [text/plain] tidrangepath.patch (750B, ../379082d6-1b6a-4cd6-9ecf-7157d8c08635@postgrespro.ru/2-tidrangepath.patch)
  download | inline diff:
diff --git a/src/backend/optimizer/path/allpaths.c b/src/backend/optimizer/path/allpaths.c
index 9bdc70c702..b0ed69d2f8 100644
--- a/src/backend/optimizer/path/allpaths.c
+++ b/src/backend/optimizer/path/allpaths.c
@@ -4470,6 +4470,9 @@ print_path(PlannerInfo *root, Path *path, int indent)
 		case T_TidPath:
 			ptype = "TidScan";
 			break;
+		case T_TidRangePath:
+			ptype = "TidRangePath";
+			break;
 		case T_SubqueryScanPath:
 			ptype = "SubqueryScan";
 			break;
@@ -4578,7 +4581,8 @@ print_path(PlannerInfo *root, Path *path, int indent)
 			subpath = ((LimitPath *) path)->subpath;
 			break;
 		default:
-			ptype = "???Path";
+			elog(WARNING, "could not print unrecognized node type: %d",
+				 (int) nodeTag(path));
 			break;
 	}
 


view thread (2+ messages)  latest in thread

Message-ID: <379082d6-1b6a-4cd6-9ecf-7157d8c08635@postgrespro.ru>
Permalink:  ../379082d6-1b6a-4cd6-9ecf-7157d8c08635@postgrespro.ru/
Also on:    postgresql.org/message-id/379082d6-1b6a-4cd6-9ecf-7157d8c08635@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-bugs@postgresql.org
  Cc: a.lepikhov@postgrespro.ru, pgsql-bugs@lists.postgresql.org, dgrowleyml@gmail.com
  Subject: Re: Missed TidRangePath in the print_path switch
  In-Reply-To: <379082d6-1b6a-4cd6-9ecf-7157d8c08635@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