Single character bitfields

From: "Andrew Maclean" <andrew(dot)amaclean(at)gmail(dot)com>
To: General <pgsql-general(at)postgresql(dot)org>
Subject: Single character bitfields
Date: 2008-08-21 02:40:29
Message-ID: e7ddbec60808201940s19bd40aese6f1795fee358785@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I have a large database and I want to have several fields (among many)
that are single character fields (in fact they are bitfields).

1) Is char(1) the most efficient way to store these fields? If not
what is better?
2) I need to test the field against constants, e.g if the field is
called source then I need tests like:
IF source = 0x10 THEN ...
This does not work in plpgsql functions (source is character(1)),
so what is the solution?

Thanks
Andrew

--
___________________________________________
Andrew J. P. Maclean
Centre for Autonomous Systems
The Rose Street Building J04
The University of Sydney 2006 NSW
AUSTRALIA
Ph: +61 2 9351 3283
Fax: +61 2 9351 7474
URL: http://www.acfr.usyd.edu.au/
___________________________________________

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Joshua Drake 2008-08-21 02:56:44 Re: Single character bitfields
Previous Message Bill 2008-08-21 02:24:28 Re: ADO/ODBC returns TEXT fields as Varchar, not LongVarChar