Re: Cache lookup errors with functions manipulation object addresses
Michael Paquier <michael@paquier.xyz>
From: Michael Paquier <michael@paquier.xyz>
To: Alvaro Herrera <alvherre@2ndquadrant.com>
Cc: Dmitry Dolgov <9erthalion6@gmail.com>, Andrew Dunstan <andrew.dunstan@2ndquadrant.com>, PostgreSQL Developers <pgsql-hackers@lists.postgresql.org>
Date: 2019-10-17T01:37:56Z
Lists: pgsql-hackers
Attachments
- v18-0001-Add-flag-to-format_type_extended-to-enforce-NULL.patch (text/x-diff) patch v18-0001
- v18-0002-Refactor-format-procedure-and-operator-APIs-to-b.patch (text/x-diff) patch v18-0002
- v18-0003-Eliminate-user-visible-cache-lookup-errors-for-o.patch (text/x-diff) patch v18-0003
On Thu, Sep 26, 2019 at 03:52:03PM +0900, Michael Paquier wrote:
> 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.
Got to think more on this one, and your idea is better. So changed
this way.
>> 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;
That's actually cleaner, so changed as well. Attached is an updated
patch set with the heap_close() calls removed as per the recent report
from Dmitry.
--
Michael
Commits
-
Eliminate cache lookup errors in SQL functions for object addresses
- 2a10fdc4307a 14.0 landed
-
Refactor routines for name lookups of procedures and operators
- aa38434824c4 14.0 landed
-
Add new flag to format_type_extended() to get NULL for undefined type
- 1185c782943c 14.0 landed
-
Introduce new extended routines for FDW and foreign server lookups
- 8fb569e978af 12.0 landed
-
Refactor routines for subscription and publication lookups
- 1d6fbc38d9ed 12.0 landed
-
get_relid_attribute_name is dead, long live get_attname
- 8237f27b504f 11.0 landed
-
Tweak parser so that there is a defined representation for datatypes
- a585c20d12d0 7.2.1 cited