pg.ddx.io pgsql-hackers@postgresql.org mailing list archive
help / color / mirror / Atom feedSELECT using arrays
3+ messages / 2 participants
[nested] [flat]
* SELECT using arrays
@ 1999-07-14 21:05 Evan Klinger <evan715@sirius.com>
0 siblings, 1 reply; 3+ messages in thread
From: Evan Klinger @ 1999-07-14 21:05 UTC (permalink / raw)
To: pgsql-hackers; +Cc: pgsql-sql@postgresql.org
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.
Thank you very much.
Evan
^ permalink raw reply [nested|flat] 3+ messages in thread
* SELECT using arrays
@ 1999-07-15 17:33 Evan Klinger <evan715@sirius.com>
0 siblings, 0 replies; 3+ messages in thread
From: Evan Klinger @ 1999-07-15 17:33 UTC (permalink / raw)
To: pgsql-hackers
I have asked this question on all of the appropriate pgsql mailing lists
and no one has been able to help. Please, if you could, help me out with
this problem. Thank you.
--
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 text[][] (in this
case it is the first element, but it may not always be) and print out
"VAL."
Any information would be greatly appreciated.
Thank you very much.
Evan
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: [SQL] SELECT using arrays
@ 1999-07-19 11:48 Herouth Maoz <herouth@oumail.openu.ac.il>
parent: Evan Klinger <evan715@sirius.com>
0 siblings, 0 replies; 3+ messages in thread
From: Herouth Maoz @ 1999-07-19 11:48 UTC (permalink / raw)
To: Evan Klinger <evan715@sirius.com>; +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
^ permalink raw reply [nested|flat] 3+ messages in thread
end of thread, other threads:[~1999-07-19 11:48 UTC | newest]
Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
1999-07-14 21:05 SELECT using arrays Evan Klinger <evan715@sirius.com>
1999-07-19 11:48 ` Herouth Maoz <herouth@oumail.openu.ac.il>
1999-07-15 17:33 SELECT using arrays Evan Klinger <evan715@sirius.com>
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