Re: pg_operator.oprcode in 9.2rc1

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Joe Abbate <jma(at)freedomcircle(dot)com>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: pg_operator.oprcode in 9.2rc1
Date: 2012-08-30 17:23:04
Message-ID: 24155.1346347384@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Joe Abbate <jma(at)freedomcircle(dot)com> writes:
> On 30/08/12 12:27, Tom Lane wrote:
>> The reason for the difference is that in 9.2 there's more than one
>> pg_catalog.upper():

> Hmmm ... Well, I'm just doing the same thing as pg_dump, which in 9.2rc1
> still outputs the same as before, namely:

Well, evidently you're *not* doing the same thing as pg_dump.

A look at pg_dump says that what it does is to cast the column to
regprocedure, and then strip the argument types from that printout.

Perhaps some experimentation would be illuminating:

regression=# select 'upper'::regproc;
ERROR: more than one function named "upper"
LINE 1: select 'upper'::regproc;
^
regression=# select 'upper(text)'::regprocedure;
regprocedure
--------------
upper(text)
(1 row)

regression=# select 'upper(text)'::regprocedure::oid;
oid
-----
871
(1 row)

regression=# select 871::regprocedure;
regprocedure
--------------
upper(text)
(1 row)

regression=# select 871::regproc;
regproc
------------------
pg_catalog.upper
(1 row)

> What's somewhat confusing is that the documentation (and \d pg_operator)
> states oprcode (as well as oprrest and oprjoin) are of type 'regproc'
> and that it references a pg_proc.oid. Does the catalog actually store
> an OID, i.e., the OID of pg_catalog.upper(text), or something else?

What's physically in there is an OID (and so the casts above are no-ops
at the representational level). What we're discussing is the behavior
of the output function for the regproc or regprocedure types.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2012-08-30 17:27:34 Re: Fix for gistchoose
Previous Message Robert Haas 2012-08-30 17:19:10 Re: Don't allow relative path for copy from file