Constructing two-dimensional arrays from a query

Поиск
Список
Период
Сортировка
От David Monarchi
Тема Constructing two-dimensional arrays from a query
Дата
Msg-id eea51fdb0711081613h63055a41oaaaa96969988c636@mail.gmail.com
обсуждение исходный текст
Список pgsql-novice
PG 8.2
Linux

Hello -

I would like to update a two-dimensional array field in a table using pure SQL.

The field is defined as text[][]

My query produces data in the form
x, y, z
where x is the value of the key in the table I want to update
         y is the value of the first element of the first subarray
         z is the value of the second element of the first array

For example, part of the result of a query might be
    x1 y1 z1
    x1 y2 z2
    x1 y3 z3

After updating the table, the row would look like this (quotes omitted
for clarity).

x1           {{y1,z1},{y2,z2},{y3,z3}}

In section 4.2.10, an examle is given using the ARRAY constructor, but
it explicitly says that the subquery must return a single column.  I
don't know if this is a limitation of 8.2 or if there is a way around
this.  The example in the manual is
        SELECT ARRAY(SELECT oid FROM pg_proc WHERE proname LIKE 'bytea%');

Any assistance would be greatly appreciated.

Thank you,
David

В списке pgsql-novice по дате отправления:

Предыдущее
От: Hans-Peter Oeri
Дата:
Сообщение: Re: Obtaining the primary key of the record just inserted
Следующее
От: "Josh Tolley"
Дата:
Сообщение: Re: Debugging question ...