Re: Re: Addition to: Trouble with initdb when the #define NAMEDATALEN = 51

From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: Lincoln Yeoh <lyeoh(at)pop(dot)jaring(dot)my>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, "G(dot) Anthony Reina" <reina(at)nsi(dot)edu>, "pgsql-hackers(at)postgreSQL(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Re: Addition to: Trouble with initdb when the #define NAMEDATALEN = 51
Date: 2001-05-12 14:02:42
Message-ID: Pine.LNX.4.30.0105121558500.757-100000@peter.localdomain
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)gmx(dot)net http://funkturm.homeip.net/~peter

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message mlw 2001-05-12 15:19:43 SET variables
Previous Message Lincoln Yeoh 2001-05-12 13:41:16 Re: Addition to: Trouble with initdb when the #define NAMEDATALEN = 51