Skip site navigation (1) Skip section navigation (2)

hiding variable-length fields from Form_pg_* structs

From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: hiding variable-length fields from Form_pg_* structs
Date: 2011-11-27 22:49:46
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-hackers
It would be helpful if variable length catalog fields (except the first
one) would not be visible on the C level in the Form_pg_* structs.  We
keep them listed in the include/catalog/pg_*.h files so that the BKI
generating code can see them and for general documentation, but the
fields are meaningless in C, and some catalog files contain free-form
comments advising the reader of that.  If we could hide them somehow, we
would avoid random programming bugs, deconfuse compilers trying to
generate useful warnings, and save occasional stack space.  There are
several known cases of the first and second issue, at least.

I haven't found the ideal way to implement that yet, but the general
idea would be something like:

CATALOG(pg_attribute,1249) BKI_BOOTSTRAP ...
    int4        attinhcount;
    Oid         attcollation;
    aclitem     attacl[1];
    text        attoptions[1];
    text        attfdwoptions[1];
} FormData_pg_attribute;

where CATVARLEN is defined empty in C, and ignored in the BKI generation

The real trick is to find something that handles well with pgindent and
indenting text editors.



pgsql-hackers by date

Next:From: Peter EisentrautDate: 2011-11-27 22:53:42
Subject: Re: pg_upgrade automatic testing
Previous:From: Tom LaneDate: 2011-11-27 22:29:50
Subject: Re: information schema/aclexplode doesn't know about default privileges

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group