From: Peter Eisentraut <peter_e@gmx.net>
To: Kevin Brannen <kevinb@nurseamerica.net>
Cc: pgsql-sql@postgresql.org
Subject: Re: bit field changes in 7.2.1
Date: Sun, 7 Jul 2002 12:59:13 +0200 (CEST)
Message-ID: <Pine.LNX.4.44.0207070003530.929-100000@localhost.localdomain> (raw)
In-Reply-To: <3D2377A6.3050006@nurseamerica.net>
Kevin Brannen writes:
> EXCEPT that now fails in 7.2.1 (I just upgraded this afternoon). It
> forces me to use "b'000000'" instead of "b'0'::bit(6)".
Which is a problem why?
> Searching thru the docs, I find a note that says:
>
> ---
> Note: Prior to PostgreSQL 7.2, BIT type data was zero-padded on the
> right. This was changed to comply with the SQL standard. To implement
> zero-padded bit strings, a combination of the concatenation operator and
> the substring function can be used.
> ---
>
> Obviously the source of my problem. However, whoever wrote that note
> didn't say how to do it (examples are *SO* useful), and I can't imagine
> the solution.
In your case the solution is to type the six zeroes.
The comment referred to cases where the results of computations needed to
be forced to the right length, in which case you could use something like
substring(computation() || b'000000' for 6)
The question whether the constant should go before or after the
computation, and whether it should be zeros or ones is a matter of taste,
which is why an example has been omitted.
--
Peter Eisentraut peter_e@gmx.net
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: peter_e@gmx.net, kevinb@nurseamerica.net
Subject: Re: bit field changes in 7.2.1
In-Reply-To: <Pine.LNX.4.44.0207070003530.929-100000@localhost.localdomain>
* 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