get_object_address support for additional object types

From: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
To: Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: get_object_address support for additional object types
Date: 2015-03-06 21:29:06
Message-ID: 20150306212906.GF3291@alvh.no-ip.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

This is extracted from the DDL deparse series. These patches add
get_object_address support for the following object types:

- user mappings
- default ACLs
- operators and functions of operator families

In each case I had to create a new value in ObjectType. These object
types can not be created from the parser, which is why they don't exist
yet. But if we want to be able to process DDL for them, then we need to
cope at this level. This is the kind of fix we need to handle the
failures related to commit a486841eb11517e.

There is one strange thing in the last one, which is that an opfamily
member is represented in two arrays like this (objname, objargs):
{opfamily identity, access method identity, number} , {left type, right type}

This is a bit odd considering that operator families themselves are
addressed like this instead:
{opfamily identity} , {access method identity}

Note that the AM name is originally in objargs and moves to objnames.
The reason I did it this way is that the objargs elements can be
processed completely as an array of TypeName, and therefore there's no
need for an extra strange case in pg_get_object_address. But it does
mean that there is some code that knows to search the strategy or
function number in a specific position in the objname array.

If we had more freedom on general object representation I'm sure we
could do better, but it's what we have. I don't think it's a tremendous
problem, considering that get_object_address gets a fairly ad-hoc
representation for each object type anyway, as each gets constructed by
the grammar.

--
Álvaro Herrera http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

Attachment Content-Type Size
0001-deparse-core-get_object_address-support-user-mapping.patch text/x-diff 14.5 KB
0002-deparse-core-get_object_address-support-default-ACLs.patch text/x-diff 15.1 KB
0003-deparse-core-get_object_address-support-opfamily-mem.patch text/x-diff 20.1 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2015-03-06 21:42:00 Re: Clamping reulst row number of joins.
Previous Message Josh Berkus 2015-03-06 20:50:14 Re: MD5 authentication needs help