From: Josh Berkus <josh@agliodbs.com>
To: S P Arif Sahari Wibowo <arifsaha@yahoo.com>
To: pgsql-novice@postgresql.org
Subject: Re: Operation on bit strings with different length
Date: Tue, 18 Dec 2001 08:37:46 -0800
Message-ID: <web-531103@davinci.ethosmedia.com> (raw)
In-Reply-To: <Pine.LNX.4.42.0112172327060.25673-100000@gede.parokinet.org>
Arif,
For future notice, the NOVICE list is the appropriate place for this
type of question.
> Do you know how to operate (AND, OR, etc.) on bit strings with
> dynamically different length? It is dynamic, means the length won't
> be
> determined until run time.
> Is there any function to extend the length of a bit string to a
> certain
> length?
PostgreSQL is currently (as far as I know) lacking a good set of bitwise
data types and operators. If you really need to use them, I suggest
that you construct them -- Postgres allows you to build your own data
types, and operators for those data types. It's a somewhat
labor-intensive process.
Most of us don't have much use for bitwise operations in the database,
because the essential intent of a bitwise number is to store several
different pieces of data in the same number. This goes against
relational principles, which say that each field should be "atomic";
that is, containing one and only one piece of information.
If, however, you are interacting with the MS API, I can see why you
would need bitwise logic. So my suggestions are:
1. Create your own data types and operators per paragraph 1;
2. Just store the integer in Postgres, and do your bitwise logic in your
interface/middleware language.
-Josh Berkus
-Josh Berkus
______AGLIO DATABASE SOLUTIONS___________________________
Josh Berkus
Complete information technology josh@agliodbs.com
and data management solutions (415) 565-7293
for law firms, small businesses fax 621-2533
and non-profit organizations. San Francisco
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: josh@agliodbs.com, arifsaha@yahoo.com, pgsql-novice@postgresql.org
Subject: Re: Operation on bit strings with different length
In-Reply-To: <web-531103@davinci.ethosmedia.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox