Question about "name" datatype

From: Greg Stark <gsstark(at)mit(dot)edu>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Question about "name" datatype
Date: 2006-05-26 21:19:46
Message-ID: 87u07co559.fsf@stark.xeocode.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


In c.h There is the following comment:

/*
* We want NameData to have length NAMEDATALEN and int alignment,
* because that's how the data type 'name' is defined in pg_type.
* Use a union to make sure the compiler agrees. Note that NAMEDATALEN
* must be a multiple of sizeof(int), else sizeof(NameData) will probably
* not come out equal to NAMEDATALEN.
*/

And indeed in pg_type the typalign column says "i" for this data type. My
question is just, why? What would be the problem with an alignment of 1 for
"name"?

--
greg

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andrew Dunstan 2006-05-26 21:26:37 Re: Updatable views/with check option parsing
Previous Message Jim C. Nasby 2006-05-26 21:04:26 Re: Compression and on-disk sorting