Re: hiding variable-length fields from Form_pg_* structs
От | Peter Eisentraut |
---|---|
Тема | Re: hiding variable-length fields from Form_pg_* structs |
Дата | |
Msg-id | 1323113223.10992.21.camel@vanquo.pezone.net обсуждение исходный текст |
Ответ на | Re: hiding variable-length fields from Form_pg_* structs (Tom Lane <tgl@sss.pgh.pa.us>) |
Ответы |
Re: hiding variable-length fields from Form_pg_* structs
|
Список | pgsql-hackers |
On sön, 2011-11-27 at 18:20 -0500, Tom Lane wrote: > The low-tech way would be > > CATALOG(pg_attribute,1249) BKI_BOOTSTRAP ... > { > ... > int4 attinhcount; > Oid attcollation; > aclitem attacl[1]; > #ifdef CATALOG_VARLEN_FIELDS > text attoptions[1]; > text attfdwoptions[1]; > #endif > } FormData_pg_attribute; Good enough. To clarify, I believe the rule is that the first variable-length field can be accessed as a struct field. Are there any exceptions to this? This kind of comment is pretty confusing: CATALOG(pg_rewrite,2618) { NameData rulename; Oid ev_class; int2 ev_attr; char ev_type; char ev_enabled; bool is_instead; /* NB: remaining fields must be accessed via heap_getattr */ pg_node_tree ev_qual; pg_node_tree ev_action; } FormData_pg_rewrite; Also, this code in relcache.c accesses indclass, which is after an int2vector and an oidvector field: /* Check to see if it is a unique, non-partial btree index on OID */ if (index->indnatts == 1 && index->indisunique&& index->indimmediate && index->indkey.values[0] == ObjectIdAttributeNumber && index->indclass.values[0]== OID_BTREE_OPS_OID && heap_attisnull(htup, Anum_pg_index_indpred)) oidIndex = index->indexrelid;
В списке pgsql-hackers по дате отправления: