Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 112bd6f

Browse files
committed
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).
1 parent 905109f commit 112bd6f

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

src/bin/psql/describe.c

+5-6
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
*
44
* Copyright 2000 by PostgreSQL Global Development Group
55
*
6-
* $Header: /cvsroot/pgsql/src/bin/psql/describe.c,v 1.41 2001/10/25 05:49:53 momjian Exp $
6+
* $Header: /cvsroot/pgsql/src/bin/psql/describe.c,v 1.42 2001/11/12 15:57:08 tgl Exp $
77
*/
88
#include "postgres_fe.h"
99
#include "describe.h"
@@ -213,15 +213,14 @@ describeOperators(const char *name)
213213
"SELECT o.oprname AS \"%s\",\n"
214214
" CASE WHEN o.oprkind='l' THEN NULL ELSE format_type(o.oprleft, NULL) END AS \"%s\",\n"
215215
" CASE WHEN o.oprkind='r' THEN NULL ELSE format_type(o.oprright, NULL) END AS \"%s\",\n"
216-
" format_type(p.prorettype, NULL) AS \"%s\",\n"
217-
" obj_description(p.oid, 'pg_proc') as \"%s\"\n"
218-
"FROM pg_proc p, pg_operator o\n"
219-
"WHERE RegprocToOid(o.oprcode) = p.oid\n",
216+
" format_type(o.oprresult, NULL) AS \"%s\",\n"
217+
" obj_description(o.oprcode, 'pg_proc') AS \"%s\"\n"
218+
"FROM pg_operator o\n",
220219
_("Name"), _("Left arg type"), _("Right arg type"),
221220
_("Result type"), _("Description"));
222221
if (name)
223222
{
224-
strcat(buf, " AND o.oprname = '");
223+
strcat(buf, "WHERE o.oprname = '");
225224
strncat(buf, name, REGEXP_CUTOFF);
226225
strcat(buf, "'\n");
227226
}

0 commit comments

Comments
 (0)