From: | "Andrew Maclean" <a(dot)maclean(at)cas(dot)edu(dot)au> |
---|---|
To: | "'Bill Moran'" <wmoran(at)collaborativefusion(dot)com> |
Cc: | "'Andrew Maclean'" <andrew(dot)amaclean(at)gmail(dot)com>, "'General'" <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: Single character bitfields |
Date: | 2008-08-21 22:04:51 |
Message-ID: | 018701c903d9$f004e910$d00ebb30$@maclean@cas.edu.au |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
-----Original Message-----
From: Bill Moran [mailto:wmoran(at)collaborativefusion(dot)com]
Sent: Thursday, 21 August 2008 22:36
To: a(dot)maclean(at)cas(dot)edu(dot)au
Cc: Andrew Maclean; General
Subject: Re: [GENERAL] Single character bitfields
In response to "Andrew Maclean" <andrew(dot)amaclean(at)gmail(dot)com>:
> 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?
I'm not sure I understand what you're trying to accomplish, but there's
a bit string type:
http://www.postgresql.org/docs/8.3/static/datatype-bit.html
--
Bill Moran
Collaborative Fusion Inc.
http://people.collaborativefusion.com/~wmoran/
wmoran(at)collaborativefusion(dot)com
Phone: 412-422-3463x4023
Thankyou for your input. I have decided to use smallint for various reasons.
From | Date | Subject | |
---|---|---|---|
Next Message | Bill | 2008-08-21 22:09:13 | Text field truncated using ADO/ODBC? |
Previous Message | Travis Smith | 2008-08-21 20:49:48 | Re: [ADMIN] Query performance difference |