pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Alvar Freude <alvar.freude@merz-akademie.de>
To: pgsql-sql@postgresql.org
Subject: Using Array-Values in subselect
Date: Tue, 14 Nov 2000 21:51:59 +0100
Message-ID: <3A11A5EF.C74A40EE@merz-akademie.de> (raw)

Hi,

i want to create a linked structure of values. Each text has an id, an
array of children ids and the value itself.

  CREATE TABLE structure
    (
    id int8,
    children int8[],
    value text
    );

Now i want to select all values which are connected to a given parent #x
at once. My first idea was this:

  SELECT value 
  FROM structure
     WHERE id IN (SELECT children FROM structure WHERE id = #x);

But this causes an error because the array field just returns a string
instead of seperated values. Is there a way to make arrays return sort
of "real arrays" or something usable in a subselect in reasonable speed?


Thank you
Alvar



-- 
Alvar C.H. Freude  |  alvar.freude@merz-akademie.de

    Demo: http://www.online-demonstration.org/  |  Mach mit!
Blast-DE: http://www.assoziations-blaster.de/   |  Blast-Dich-Fit
Blast-EN: http://www.a-blast.org/               |  Blast/english



view thread (7+ messages)  latest in thread

Message-ID: <3A11A5EF.C74A40EE@merz-akademie.de>
Permalink:  ../3A11A5EF.C74A40EE@merz-akademie.de/
Also on:    postgresql.org/message-id/3A11A5EF.C74A40EE@merz-akademie.de

 · 

reply

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: alvar.freude@merz-akademie.de
  Subject: Re: Using Array-Values in subselect
  In-Reply-To: <3A11A5EF.C74A40EE@merz-akademie.de>
  References: <3A11A5EF.C74A40EE@merz-akademie.de>

* 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