Re: [GENERAL] How to store multiple rows in array . - Mailing list pgsql-general

From Tom Lane
Subject Re: [GENERAL] How to store multiple rows in array .
Date
Msg-id 14909.1511149684@sss.pgh.pa.us
Whole thread Raw
In response to Re: [GENERAL] How to store multiple rows in array .  (brahmesr <brahmam1234@gmail.com>)
List 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 by date:

Previous
From: brahmesr
Date:
Subject: Re: [GENERAL] How to store multiple rows in array .
Next
From: Cory Tucker
Date:
Subject: [GENERAL] Query Using Massive Temp Space