Received: from localhost.localdomain (postgresql.org [64.49.215.8]) by localhost (Postfix) with ESMTP id 4AB96475CA0 for ; Sun, 7 Jul 2002 06:59:08 -0400 (EDT) Mailbox-Line: From peter_e@gmx.net Sun Jul 7 06:59:08 2002 Received: from mail.gmx.net (mail.gmx.net [213.165.64.20]) by postgresql.org (Postfix) with SMTP id 23C23475BD2 for ; Sun, 7 Jul 2002 06:57:05 -0400 (EDT) Received: (qmail 10655 invoked by uid 0); 7 Jul 2002 10:57:06 -0000 Received: from pd902f0fe.dip0.t-ipconnect.de (217.2.240.254) by mail.gmx.net (mp004-rz3) with SMTP; 7 Jul 2002 10:57:06 -0000 Date: Sun, 7 Jul 2002 12:59:13 +0200 (CEST) From: Peter Eisentraut X-X-Sender: peter@localhost.localdomain To: Kevin Brannen Cc: pgsql-sql@postgresql.org Subject: Re: bit field changes in 7.2.1 In-Reply-To: <3D2377A6.3050006@nurseamerica.net> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Spam-Status: No, hits=-3.4 required=5.0 tests=IN_REP_TO version=2.30 X-Spam-Level: X-Archive-Number: 200207/77 X-Sequence-Number: 8456 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