Re: note on dropped columns in pg_attribute

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Peter Eisentraut <peter_e(at)gmx(dot)net>
Cc: Robert Treat <xzilla(at)users(dot)sourceforge(dot)net>, pgsql-patches(at)postgresql(dot)org
Subject: Re: note on dropped columns in pg_attribute
Date: 2003-09-05 21:40:57
Message-ID: 19499.1062798057@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-patches

Peter Eisentraut <peter_e(at)gmx(dot)net> writes:
> Robert Treat writes:
>> I didn't see it documented anywhere that a 0 in attypid of pg_attribute,
>> and given the note on the need to match pg_type lest failure seems to
>> warrant the mention.

> A column is dropped if and only if attisdropped is true.

Yes. If we're going to add something to pg_attribute.h, it ought to say
that atttypid is *undefined* in a dropped column. The last thing we
need is people testing it instead of attisdropped.

Also, any such documentation addition should go into catalogs.sgml not
only the .h file.

BTW, the rationale for the behavior Robert noticed is explained in heap.c:

/*
* Set the type OID to invalid. A dropped attribute's type link
* cannot be relied on (once the attribute is dropped, the type might
* be too). Fortunately we do not need the type row --- the only
* really essential information is the type's typlen and typalign,
* which are preserved in the attribute's attlen and attalign. We set
* atttypid to zero here as a means of catching code that incorrectly
* expects it to be valid.
*/
attStruct->atttypid = InvalidOid;

regards, tom lane

In response to

Browse pgsql-patches by date

  From Date Subject
Next Message Andreas Pflug 2003-09-05 21:46:04 Re: IPV4 addresses on IPV6 machines in pg_hba.conf
Previous Message Peter Eisentraut 2003-09-05 21:19:16 Re: [PATCHES] Warning for missing createlang