Pb with arrays in PostgresQL

Started by Pascale Thomasover 25 years ago2 messagesbugs
Jump to latest
#1Pascale Thomas
p.thomas@smie.com

Hello,

My name : Pascale Thomas
My E-mail : p.thomas@smie.com

Configuration : PostgreSQL 6.5.1 on i686-pc-linux-gnu, compiled by gcc
pgcc-2.91.66

I have problems with an array in a table.
The name of the table is "societe", the name of the array is "event_ok",

declared in my create table operation as "event_ok int2[]".
It is an array of integer, as described in the postgresql documentation.

(Postgresql User's Guide, chapter 8, Arrays).
I have initiated each array in a row with 40 values.
I trie to access a single element in the array using the select command
:
"select nom_soc from societe where event_ok[1]=1"
The error message is : Unable to locate type name 'event_ok' in catalog
If I do "select event_ok from societe", no problem, the total array of
each row of the table is described.
Otherwise, if I do "select event_ok[1] from societe", the same error
message occurs.
The operation of updating a single element of the array works correctly.

Where is the bug ?
Thank you for answer.

#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: Pascale Thomas (#1)
Re: Pb with arrays in PostgresQL

Pascale Thomas <p.thomas@smie.com> writes:

"select nom_soc from societe where event_ok[1]=1"
The error message is : Unable to locate type name 'event_ok' in catalog

In 6.5.* this only works if you write out the fully qualified name:
select nom_soc from societe where societe.event_ok[1]=1

I'd strongly recommend updating to Postgres 7.0.2, because this is not
the only array-related bug you will find in 6.5 ...

regards, tom lane