weird objectaddress.c entry for transforms

Started by Andres Freundover 7 years ago2 messageshackers
Jump to latest
#1Andres Freund
andres@anarazel.de

Hi Peter, Alvaro, All,

(Peter, this is your change, Alvaro, you're the objectaddress.c master)

While looking through my oids removal patch I noticed that the
objectaddress.c ObjectProperty entry for transforms looks wrong:

typedef struct
{
Oid class_oid; /* oid of catalog */
Oid oid_index_oid; /* oid of index on system oid column */
int oid_catcache_id; /* id of catcache on system oid column */
int name_catcache_id; /* id of catcache on (name,namespace), or
* (name) if the object does not live in a
* namespace */
AttrNumber attnum_name; /* attnum of name field */
AttrNumber attnum_namespace; /* attnum of namespace field */
AttrNumber attnum_owner; /* attnum of owner field */
AttrNumber attnum_acl; /* attnum of acl field */
ObjectType objtype; /* OBJECT_* of this object type */
bool is_nsp_name_unique; /* can the nsp/name combination (or name
* alone, if there's no namespace) be
* considered a unique identifier for an
* object of this class? */
} ObjectPropertyType;

{
TransformRelationId,
TransformOidIndexId,
TRFOID,
InvalidAttrNumber,
},

this was added in https://git.postgresql.org/gitweb/?p=postgresql.git;a=commit;h=cac76582053e

The InvalidAttrNumber entry initializes the member for name_catcache_id,
instead of -1 as the other entries, and in contrast to the rest of the
entries it doesn't initialize the other fields. In particular objtype is
0 instead of -1 as the rest.

Greetings,

Andres Freund

#2Andres Freund
andres@anarazel.de
In reply to: Andres Freund (#1)
Re: weird objectaddress.c entry for transforms

On 2018-11-19 17:53:22 -0800, Andres Freund wrote:

Hi Peter, Alvaro, All,

(Peter, this is your change, Alvaro, you're the objectaddress.c master)

While looking through my oids removal patch I noticed that the
objectaddress.c ObjectProperty entry for transforms looks wrong:

typedef struct
{
Oid class_oid; /* oid of catalog */
Oid oid_index_oid; /* oid of index on system oid column */
int oid_catcache_id; /* id of catcache on system oid column */
int name_catcache_id; /* id of catcache on (name,namespace), or
* (name) if the object does not live in a
* namespace */
AttrNumber attnum_name; /* attnum of name field */
AttrNumber attnum_namespace; /* attnum of namespace field */
AttrNumber attnum_owner; /* attnum of owner field */
AttrNumber attnum_acl; /* attnum of acl field */
ObjectType objtype; /* OBJECT_* of this object type */
bool is_nsp_name_unique; /* can the nsp/name combination (or name
* alone, if there's no namespace) be
* considered a unique identifier for an
* object of this class? */
} ObjectPropertyType;

{
TransformRelationId,
TransformOidIndexId,
TRFOID,
InvalidAttrNumber,
},

this was added in https://git.postgresql.org/gitweb/?p=postgresql.git;a=commit;h=cac76582053e

The InvalidAttrNumber entry initializes the member for name_catcache_id,
instead of -1 as the other entries, and in contrast to the rest of the
entries it doesn't initialize the other fields. In particular objtype is
0 instead of -1 as the rest.

Also, uh, shouldn't this actually fill out some of those fields? Most of
them actually apply to transforms.

Greetings,

Andres Freund