Re: Convert Arbitrary Table to Array?

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Convert Arbitrary Table to Array?
Дата
Msg-id 17050.1234200030@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Convert Arbitrary Table to Array?  (Lee Hughes <lee@hughesys.com>)
Ответы Re: Convert Arbitrary Table to Array?  (Lee Hughes <lee@hughesys.com>)
Список pgsql-general
Lee Hughes <lee@hughesys.com> writes:
> Hi, I need a function that accepts a table name and returns a 2-dimensional
> array of the table data.

Well, in 8.3 and up there are arrays of composite types, so you can
do something like

        select array(select mytable from mytable);

However you are not going to be able to encapsulate that as a function
real well, because of the question of what is the function's result
type.

You should also realize that this approach is not going to scale to
large tables.  You don't want to get into pushing around arrays of more
than say a couple of megabytes.

Personally I'd be wondering exactly where this requirement comes from
and whether it doesn't betoken severe database-ignorance in the
application design.

            regards, tom lane

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

Предыдущее
От: Alvaro Herrera
Дата:
Сообщение: Re: Pet Peeves?
Следующее
От: Steve Crawford
Дата:
Сообщение: Re: Pet Peeves?