Array manipulation/syntax question

From: Bart Grantham <bart(at)logicworks(dot)net>
To: pgsql-general(at)postgresql(dot)org
Cc: bart(at)logicworks(dot)net
Subject: Array manipulation/syntax question
Date: 2005-05-09 23:05:18
Message-ID: 427FECAE.4080008@logicworks.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hello again. I had a problem a few weeks ago with using IN ( some_array
) having really rough performance. Special thanks to Ron Mayer for the
suggestion of using int_array_enum(some_array) to join against. I had
to upgrade to PG8 but that technique works really well. Now I have a
question about array manipulation. Specifically, how can I build an
array from the result of a query without resorting to array_append()? I
have a recursive function that passes itself an array each time and I
want to build this array by taking a column out of a query (which is a
join from the input array and a table... see? recursive!). This
becomes a performance issue since the query tha wraps array_append could
be returning many thousands of rows. Hmm, my question is sounding more
complicated it should. Let me put it this way... how do I do this:

-- my_array is an INT[]

_my_array := select some_column from some_table;

... in plpgsql?

Thanks in advance.

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Ragnar Hafstað 2005-05-09 23:34:40 Re: backup compress...blobs/insert commands/verbose
Previous Message Alex Turner 2005-05-09 22:59:44 Re: Data Modelling Tools