On 2015-02-19 14:39:27 -0300, Alvaro Herrera wrote:
> diff --git a/src/backend/catalog/objectaddress.c b/src/backend/catalog/objectaddress.c
> index d899dd7..2bbc15d 100644
> --- a/src/backend/catalog/objectaddress.c
> +++ b/src/backend/catalog/objectaddress.c
> @@ -531,6 +531,12 @@ ObjectTypeMap[] =
> { "policy", OBJECT_POLICY }
> };
>
> +ObjectAddress InvalidObjectAddress =
> +{
> + InvalidOid,
> + InvalidOid,
> + 0
> +};
Maybe mark it as a constant? Then it can live in some readonly section.
> +extern ObjectAddress InvalidObjectAddress;
> +
> +#define initObjectAddress(addr, class_id, object_id) \
> + do { \
> + (addr).classId = (class_id); \
> + (addr).objectId = (object_id); \
> + (addr).objectSubId = 0; \
> + } while (0)
> +
> +#define initObjectAddressSub(addr, class_id, object_id, object_sub_id) \
> + do { \
> + (addr).classId = (class_id); \
> + (addr).objectId = (object_id); \
> + (addr).objectSubId = (object_sub_id); \
> + } while (0)
> +
Maybe, based on some precedent, make those ObjectAddressSet(Sub)?() -
the init bit in initObjectAddress sounds to me like like it does more
than setting a couple member variables.
I'd also be inclined to make initObjectAddress use initObjectAddressSub,
but that's reaching the realm of pedantism ;)
To me the change sounds like a good idea - drop/rename are already
handled somewhat generically, and expanding that to the return value for
renames sounds like a natural progression to me.
Greetings,
Andres Freund
-- Andres Freund http://www.2ndQuadrant.com/PostgreSQL Development, 24x7 Support, Training &
Services