Re: name vs varchar vs text?

From: Ian Lance Taylor <ian(at)airs(dot)com>
To: "mike" <mike(at)quadrent(dot)net>
Cc: <pgsql-general(at)postgresql(dot)org>
Subject: Re: name vs varchar vs text?
Date: 2001-03-06 17:54:46
Message-ID: siae6yn5p5.fsf@daffy.airs.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

"mike" <mike(at)quadrent(dot)net> writes:

> reading through the curent development docs, I've run accross a data type called "name", and it looks very similar to varchar or text, and I'm wondering if there is any atvantage to useing this data type over varchar or even text?

The NAME type is used to hold table and column names. It is a fixed
length char field of length NAMEDATALEN in postgres_ext.h (default
32).

If you happen to want a field which has a fixed size of 32 characters,
you can use NAME. Or you can use CHAR(32). NAME is actually slightly
different from CHAR(32), in that no length is stored with a NAME
field. That probably makes NAME a bit more efficient. I don't know
why a length is stored with a fixed length CHAR field, but it is.

Ian

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Soma Interesting 2001-03-06 18:56:40 time to integer
Previous Message Stuart Foster 2001-03-06 17:47:33 libpq++ bug ?