Re: Re: Addition to: Trouble with initdb when the #define NAMEDATALEN = 51 - Mailing list pgsql-hackers

From Peter Eisentraut
Subject Re: Re: Addition to: Trouble with initdb when the #define NAMEDATALEN = 51
Date
Msg-id Pine.LNX.4.30.0105121558500.757-100000@peter.localdomain
Whole thread Raw
In response to Re: Addition to: Trouble with initdb when the #define NAMEDATALEN = 51  (Lincoln Yeoh <lyeoh@pop.jaring.my>)
List pgsql-hackers
Lincoln Yeoh writes:

> At 12:35 AM 5/12/01 -0400, Tom Lane wrote:
> >BTW, 51 is a gratuitously wasteful setting --- given alignment
> >considerations, any value that's not a multiple of 4 is pointless.
> >(It should work ... but it's pointless.)
>
> Would n^2-1 or n*8 -1 be better than n^2 or n*8?

The important issue here is the storage layout of the system catalog
tuples.  If you take a look you will see that in most tables the field
after a name field is either an oid or an int4, both of which generally
require 4-byte alignment.  Since names are also 4-byte aligned you will
waste up to 3 bytes in padding if you don't choose NAMEDATALEN a multple
of 4.

Note that the system will actually only allow NAMEDATALEN-1 characters in
a name, maybe you were referring to that.

-- 
Peter Eisentraut   peter_e@gmx.net   http://funkturm.homeip.net/~peter



pgsql-hackers by date:

Previous
From: Lincoln Yeoh
Date:
Subject: Re: Addition to: Trouble with initdb when the #define NAMEDATALEN = 51
Next
From: Tom Lane
Date:
Subject: Re: Addition to: Trouble with initdb when the #define NAMEDATALEN = 51