fix for psql's \dd version check

Started by Josh Kupershmidtabout 14 years ago2 messages
#1Josh Kupershmidt
schmiddy@gmail.com
1 attachment(s)

Someone (me) didn't get the version check for part of psql's \dd
command quite right. I was using a 9.2 client on a 9.1 server and got
this when I ran \dd:

ERROR: function pg_catalog.pg_opfamily_is_visible(oid) does not exist
LINE 33: AND pg_catalog.pg_opfamily_is_visible(opf.oid)

since pg_opfamily_is_visible() is only available for 9.2 and up.
Attached is a simple fix.

Josh

Attachments:

dd_opfamily_version_check.diffapplication/octet-stream; name=dd_opfamily_version_check.diffDownload
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
new file mode 100644
index b5c14c5..c588911
*** a/src/bin/psql/describe.c
--- b/src/bin/psql/describe.c
*************** objectDescription(const char *pattern, b
*** 902,908 ****
  		processSQLNamePattern(pset.db, &buf, pattern, true, false,
  							  "n.nspname", "o.opcname", NULL,
  							  "pg_catalog.pg_opclass_is_visible(o.oid)");
! 
  		/* Operator family descriptions */
  		appendPQExpBuffer(&buf,
  						  "UNION ALL\n"
--- 902,910 ----
  		processSQLNamePattern(pset.db, &buf, pattern, true, false,
  							  "n.nspname", "o.opcname", NULL,
  							  "pg_catalog.pg_opclass_is_visible(o.oid)");
! 	}
! 	if (pset.sversion >= 90200)
! 	{
  		/* Operator family descriptions */
  		appendPQExpBuffer(&buf,
  						  "UNION ALL\n"
#2Robert Haas
robertmhaas@gmail.com
In reply to: Josh Kupershmidt (#1)
Re: fix for psql's \dd version check

On Fri, Nov 11, 2011 at 6:59 PM, Josh Kupershmidt <schmiddy@gmail.com> wrote:

Someone (me) didn't get the version check for part of psql's \dd
command quite right. I was using a 9.2 client on a 9.1 server and got
this when I ran \dd:

ERROR:  function pg_catalog.pg_opfamily_is_visible(oid) does not exist
LINE 33:   AND pg_catalog.pg_opfamily_is_visible(opf.oid)

since pg_opfamily_is_visible() is only available for 9.2 and up.
Attached is a simple fix.

Thanks, committed with some comments.

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