Re: [GENERAL] How to store multiple rows in array .

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: [GENERAL] How to store multiple rows in array .
Дата
Msg-id 14909.1511149684@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: [GENERAL] How to store multiple rows in array .  (brahmesr <brahmam1234@gmail.com>)
Список pgsql-general
brahmesr <brahmam1234@gmail.com> writes:
> SELECT ARRAY (SELECT ROW (COL1,COL2, COUNT(*) *AS txn_cnt* )::
> ap.validate_crtr_line_items$inv_lines_rt FROM Distinct_Records GROUP BY
> COL1, COL2  HAVING COUNT(*) > 1) INTO L_INV_LINES;

> ERROR:  syntax error at or near "AS"
> LINE 73: COL1,COL2, COUNT(*) AS txn_cnt...

> Why "AS" is throwing an error ?

"AS" is part of SELECT-list syntax, not ROW(...) syntax.

Even if it were allowed in ROW(), it would be totally pointless in
this context, because when you cast the ROW() result to the
ap.validate_crtr_line_items$inv_lines_rt composite type, that type
is what determines the column names.
        regards, tom lane


-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

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

Предыдущее
От: brahmesr
Дата:
Сообщение: Re: [GENERAL] How to store multiple rows in array .
Следующее
От: Cory Tucker
Дата:
Сообщение: [GENERAL] Query Using Massive Temp Space