Received: from mx99.openu.ac.il (arbel.openu.ac.il [147.233.32.4]) by hub.org (8.9.3/8.9.3) with ESMTP id HAA37166 for ; Mon, 19 Jul 1999 07:48:36 -0400 (EDT) (envelope-from herouth@oumail.openu.ac.il) Received: from talmon.openu.ac.il (talmon.openu.ac.il [147.233.32.11]) by mx99.openu.ac.il (Postfix) with ESMTP for id 7C0324B58F; Mon, 19 Jul 1999 14:48:34 +0300 (IDT) Received: from [147.233.159.109] (mac-herouth.pc.openu.ac.il) by talmon.openu.ac.il (Netscape Messaging Server 3.54) with ESMTP id AAA5718; Mon, 19 Jul 1999 14:51:47 +0300 X-Sender: herouth@shaked.cc.openu.ac.il Message-Id: In-Reply-To: <378CFB7C.6BE05DA0@sirius.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Date: Mon, 19 Jul 1999 14:48:57 +0300 To: Evan Klinger From: Herouth Maoz Subject: Re: [SQL] SELECT using arrays Cc: pgsql-sql@postgreSQL.org 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