Commit 112bd6f0 authored by Tom Lane's avatar Tom Lane

psql's \do was going out of its way to lie about the result type of

operators.  Should report the declared oprresult type, not the return type
of the underlying proc, which might be only binary-compatible (cf.
textcat entries).
parent 905109f2
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* *
* Copyright 2000 by PostgreSQL Global Development Group * Copyright 2000 by PostgreSQL Global Development Group
* *
* $Header: /cvsroot/pgsql/src/bin/psql/describe.c,v 1.41 2001/10/25 05:49:53 momjian Exp $ * $Header: /cvsroot/pgsql/src/bin/psql/describe.c,v 1.42 2001/11/12 15:57:08 tgl Exp $
*/ */
#include "postgres_fe.h" #include "postgres_fe.h"
#include "describe.h" #include "describe.h"
...@@ -213,15 +213,14 @@ describeOperators(const char *name) ...@@ -213,15 +213,14 @@ describeOperators(const char *name)
"SELECT o.oprname AS \"%s\",\n" "SELECT o.oprname AS \"%s\",\n"
" CASE WHEN o.oprkind='l' THEN NULL ELSE format_type(o.oprleft, NULL) END AS \"%s\",\n" " CASE WHEN o.oprkind='l' THEN NULL ELSE format_type(o.oprleft, NULL) END AS \"%s\",\n"
" CASE WHEN o.oprkind='r' THEN NULL ELSE format_type(o.oprright, NULL) END AS \"%s\",\n" " CASE WHEN o.oprkind='r' THEN NULL ELSE format_type(o.oprright, NULL) END AS \"%s\",\n"
" format_type(p.prorettype, NULL) AS \"%s\",\n" " format_type(o.oprresult, NULL) AS \"%s\",\n"
" obj_description(p.oid, 'pg_proc') as \"%s\"\n" " obj_description(o.oprcode, 'pg_proc') AS \"%s\"\n"
"FROM pg_proc p, pg_operator o\n" "FROM pg_operator o\n",
"WHERE RegprocToOid(o.oprcode) = p.oid\n",
_("Name"), _("Left arg type"), _("Right arg type"), _("Name"), _("Left arg type"), _("Right arg type"),
_("Result type"), _("Description")); _("Result type"), _("Description"));
if (name) if (name)
{ {
strcat(buf, " AND o.oprname = '"); strcat(buf, "WHERE o.oprname = '");
strncat(buf, name, REGEXP_CUTOFF); strncat(buf, name, REGEXP_CUTOFF);
strcat(buf, "'\n"); strcat(buf, "'\n");
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment