Bug in pg_describe_object (was: Re: [HACKERS] obj_unique_identifier(oid))

Andreas Karlsson <andreas@proxel.se>

From: Andreas Karlsson <andreas@proxel.se>
To: Joel Jacobson <joel@gluefinance.com>
Cc: Robert Haas <robertmhaas@gmail.com>, Magnus Hagander <magnus@hagander.net>, Dimitri Fontaine <dimitri@2ndquadrant.fr>, Jim Nasby <jim@nasby.net>, Herrera Alvaro <alvherre@commandprompt.com>, pgsql-hackers Hackers <pgsql-hackers@postgresql.org>
Date: 2011-01-10T19:38:50Z
Lists: pgsql-hackers

Commits

Same data as JSON: GET /api/v1/messages/:b64id/commits the thread's linked commits as JSON, with link sources. API reference →
  1. Add pg_describe_object function

Attachments

Here is the bug-fix patch again with a description of the context so I
can add it to the commit fest.

Joel Jacobson discovered a bug in the function pg_describe_object where
it does not produce unique identifiers for some entries in pg_amproc.

This patch fixes the bug where when two entries in pg_amproc only differ
in amproclefttype or amprocrighttype the same description will be
produced by pg_describe_object, by simply adding the two fields
(amproclefttype, amprocrighttype) to the description.

== Before patch

SELECT pg_describe_object('pg_amproc'::regclass,oid,0)
    FROM pg_amproc WHERE oid IN (10608,10612);
                                 pg_describe_object                                 
------------------------------------------------------------------------------------
 function 1 bttextcmp(text,text) of operator family array_ops for access method gin
 function 1 bttextcmp(text,text) of operator family array_ops for access method gin
(2 rows)

== After patch

SELECT pg_describe_object('pg_amproc'::regclass,oid,0)
    FROM pg_amproc WHERE oid IN (10608,10612);
                                                        pg_describe_object                                                        
----------------------------------------------------------------------------------------------------------------------------------
 function 1 bttextcmp(text,text) of operator family array_ops for access method gin for (text[],text[])
 function 1 bttextcmp(text,text) of operator family array_ops for access method gin for (character varying[],character varying[])
(2 rows)

Regards,
Andreas