Re: Cache lookup errors with functions manipulation object addresses - Mailing list pgsql-hackers

From Michael Paquier
Subject Re: Cache lookup errors with functions manipulation object addresses
Date
Msg-id 20190926065203.GA2448@paquier.xyz
Whole thread Raw
In response to Re: Cache lookup errors with functions manipulation object addresses  (Alvaro Herrera <alvherre@2ndquadrant.com>)
Responses Re: Cache lookup errors with functions manipulation object addresses
List pgsql-hackers
On Wed, Sep 25, 2019 at 09:21:03AM -0300, Alvaro Herrera wrote:
> On 2019-Sep-24, Michael Paquier wrote:
>> + * - FORMAT_TYPE_FORCE_NULL
>> + *      if the type OID is invalid or unknown, return NULL instead of ???
>> + *      or such
>
> I think FORCE_NULL is a strange name for this flag (and its two
> siblings); I think something like FORMAT_TYPE_INVALID_AS_NULL is
> clearer.

Good idea.  I see the point.  Patches 0001 and 0002 are an easy cut.
For patch 0003, we could also argue if we'd want another flavor of
getObjectIdentity() (an "extended" version) which takes an extra
argument so as we reduce the size of the patch as there would be no
need to update all the existing callers (note: I still think no on
this one).

> I have still to review this comprehensively, but one thing I don't quite
> like is the shape of the new regression tests, which seem a bit too
> bulky ... why not use the style elsewhere in that file, with a large
> VALUES clause to supply input params for a single query? That would be
> a lot faster, too.

That makes sense.  Here is how I would write it then:
WITH objects (classid, objid, objsubid) AS (VALUES
    ('pg_class'::regclass, 0, 0), -- no relation
    [ ... ]
  )
SELECT ROW(pg_identify_object(objects.classid, objects.objid, objects.objsubid))
         AS ident,
       ROW(pg_identify_object_as_address(objects.classid, objects.objid, objects.objsubid))
         AS addr,
       pg_describe_object(objects.classid, objects.objid, objects.objsubid)
         AS descr,
FROM objects
ORDER BY objects.classid, objects.objid, objects.objsubid;
--
Michael

Attachment

pgsql-hackers by date:

Previous
From: Fabien COELHO
Date:
Subject: Re: pgbench - allow to create partitioned tables
Next
From: Michael Paquier
Date:
Subject: Re: PostgreSQL12 and older versions of OpenSSL