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

Re: hiding variable-length fields from Form_pg_* structs

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Peter Eisentraut <peter_e(at)gmx(dot)net>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: hiding variable-length fields from Form_pg_* structs
Date: 2011-12-05 20:16:20
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-hackers
On Mon, Dec 5, 2011 at 3:12 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> Robert Haas <robertmhaas(at)gmail(dot)com> writes:
>> On Mon, Dec 5, 2011 at 2:47 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>>> Peter Eisentraut <peter_e(at)gmx(dot)net> writes:
>>>> 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?
>>> If it is known not null, yes, but I wonder just how many places actually
>>> depend on that.
>> My impression is that all the varlena fields also allow nulls.
> See MARKNOTNULL in bootstrap.c.  I think the exceptions were designed to
> protect direct accesses to pg_index.

Hmm, OK.

rhaas=# select r.relname, a.attname, a.atttypid::regtype from pg_class
r, pg_attribute a where relnamespace=11 and relkind='r' and attrelid =
r.oid and a.attnotnull and a.attlen<0;
  relname   |   attname    |  atttypid
 pg_proc    | proargtypes  | oidvector
 pg_index   | indkey       | int2vector
 pg_index   | indcollation | oidvector
 pg_index   | indclass     | oidvector
 pg_index   | indoption    | int2vector
 pg_trigger | tgattr       | int2vector
(6 rows)

Robert Haas
The Enterprise PostgreSQL Company

In response to


pgsql-hackers by date

Next:From: Dimitri FontaineDate: 2011-12-05 21:15:20
Subject: Re: Command Triggers
Previous:From: Bruce MomjianDate: 2011-12-05 20:12:35
Subject: JSON for PG 9.2

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