Re: selecting array slice problem

From: Michael Fuhr <mike(at)fuhr(dot)org>
To: Alex Jiang <ajiangenator(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: selecting array slice problem
Date: 2006-01-20 02:58:45
Message-ID: 20060120025845.GA30818@winnie.fuhr.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Thu, Jan 19, 2006 at 05:34:29PM -0800, Alex Jiang wrote:
> I'm trying to access a bit array field that is declared as
>
> sp1 bit[][]
>
> When I attempt to access a slice of the array with the following command:
>
> SELECT sp1[1:2][1]
>
> I get the error: ' Field '2][1]' is of an unknown type'.

Is that the exact error message? I can't find it anywhere in the
source code so I suspect it's an error from your client library.

> Postgre seems to think that the characters following the colon is a name for
> a field.

Works here in 8.0.6:

test=> CREATE TABLE foo (sp1 bit[][]);
CREATE TABLE
test=> INSERT INTO foo VALUES ('{{0,1},{1,0}}');
INSERT 0 1
test=> SELECT sp1[1:2][1] FROM foo;
sp1
-----------
{{0},{1}}
(1 row)

> I am using Postgresql 8.0-beta1 and my application is written in Delphi 5.

Release versions of 8.0 have been available for a year and the
latest is 8.0.6. Running an old early beta isn't a good idea; lots
of bugs have been fixed since then.

> I access the database through the BDE.

What happens if you run the same query in psql? If it works in
psql then the problem is likely with Delphi.

--
Michael Fuhr

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Rich Shepard 2006-01-20 03:08:22 Re: Upgrade Problem: 7.4.3 -> 8.1.2
Previous Message Michael Fuhr 2006-01-20 02:24:53 Re: What is the maximum length of an IN(a, b, c....d) list in PostgreSQL