Обсуждение: selecting array slice problem

Поиск
Список
Период
Сортировка

selecting array slice problem

От
Alex Jiang
Дата:
Hi,

Please help.

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'.
Postgre seems to think that the characters following the colon is a name for a field.
I am using Postgresql 8.0-beta1 and my application is written in Delphi 5.  I access the database through the BDE.
Is there any solution to this.
Thank you for all your help.

Alex

Re: selecting array slice problem

От
Michael Fuhr
Дата:
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