From: Herouth Maoz <herouth@oumail.openu.ac.il>
To: Evan Klinger <evan715@sirius.com>
Cc: pgsql-sql@postgreSQL.org
Subject: Re: [SQL] SELECT using arrays
Date: Mon, 19 Jul 1999 14:48:57 +0300
Message-ID: <l03130302b3b8bfad056c@[147.233.159.109]> (raw)
In-Reply-To: <378CFB7C.6BE05DA0@sirius.com>
At 00:05 +0300 on 15/07/1999, Evan Klinger wrote:
> I have been playing around with this for some time now to no avail. I
> have a table info with a two-dimensional text type array action. Is
> there any way to select the corresponding value of one of the elements
> without knowing the order of the elements?
>
> E.g.
>
> CREATE TABLE info (action text[][]);
>
> INSERT INTO info VALUES ('{{"VAR","VAL"},{"VAR2","VAL2"}}');
>
> Now what SELECT query will search for "VAR" within action (in this
> case it is the first element, but it may not always be) and print out
> "VAL."
>
>
> Any information would be greatly appreciated.
I think somewhere, somehow, in the Postgres documentation, it should be
written that arrays are only recommended to be used as a bulk, like a
polygon or an image. You can update them or get a particular item in them,
but nothing furter than that.
If you need anything further, don't use arrays, but use the relational data
model and arrange the related data in a related table. Collecting all the
values together is a pretty easy trick from the frontend. So is population
of the table. The said type of searches should become much much easier.
Herouth
--
Herouth Maoz, Internet developer.
Open University of Israel - Telem project
http://telem.openu.ac.il/~herutma
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 from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-sql@postgresql.org
Cc: herouth@oumail.openu.ac.il, evan715@sirius.com
Subject: Re: [SQL] SELECT using arrays
In-Reply-To: <l03130302b3b8bfad056c@[147.233.159.109]>
References: <378CFB7C.6BE05DA0@sirius.com> <l03130302b3b8bfad056c@[147.233.159.109]>
* 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