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

Re: Poor-man's enumeration type

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Michael Glaesemann <grzm(at)myrealbox(dot)com>
Cc: KeithW(at)NarrowPathInc(dot)com,PostgreSQL Novice <pgsql-novice(at)postgresql(dot)org>
Subject: Re: Poor-man's enumeration type
Date: 2005-04-26 05:06:51
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-novice
Michael Glaesemann <grzm(at)myrealbox(dot)com> writes:
> On Apr 26, 2005, at 11:52, Keith Worthington wrote:
>> The type "char" (note the quotes) is different
>> from char(1)in that it only uses one byte of
>> storage. It is internally used in the system
>> catalogs as a poor-man's enumeration type.
>> Is this a SQL standard data type?

> No.


>> Can I expect this type to be supported in PostgreSQL 'forever'?

> I'm not in a position to say, but I do know that "It is internally used 
> in the system catalogs" and the system catalogs carry with them the 
> explicit warning that they may change--and have changed in the 
> past--between releases.

It's unlikely that we'd get rid of "char", simply because it'd be more
work to get rid of its uses in the system catalogs than it would be
worth.  But bear in mind that we do feel free to whack around behaviors
that are not mandated by the SQL spec.  As an example, there used to be
arithmetic operators (!) on the "char" type, but we got rid of them
because they caused great confusion.

If you use "char" columns only to store and retrieve single ASCII
characters, and don't expect any more operations on them than simple
comparisons, I think you'll be fine for the foreseeable future.

			regards, tom lane

In response to


pgsql-novice by date

Next:From: DeepbluesDate: 2005-04-26 13:25:11
Subject: calling perl program within a cgi script with parameters from html form
Previous:From: Michael GlaesemannDate: 2005-04-26 03:08:53
Subject: Re: Poor-man's enumeration type

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