From: Tom Lane <tgl@sss.pgh.pa.us>
To: brahmesr <brahmam1234@gmail.com>
Cc: pgsql-general@postgresql.org
Subject: Re: How to store multiple rows in array .
Date: Sun, 19 Nov 2017 22:48:04 -0500
Message-ID: <14909.1511149684@sss.pgh.pa.us> (raw)
In-Reply-To: <1511143938357-0.post@n3.nabble.com>
References: <CA+wLFo2wXFyAmb26Qk8-HTELi0fb4Kr9-k0fAmJFYWh=xbDjZQ@mail.gmail.com>
<CAFj8pRBmDcB_0nMQp4uiyV6XMZTh3xAhARRyiatR=7ZELyq0+g@mail.gmail.com>
<11642.1511116381@sss.pgh.pa.us>
<1511143938357-0.post@n3.nabble.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-general@postgresql.org
Cc: tgl@sss.pgh.pa.us, brahmam1234@gmail.com
Subject: Re: How to store multiple rows in array .
In-Reply-To: <14909.1511149684@sss.pgh.pa.us>
References: <CA+wLFo2wXFyAmb26Qk8-HTELi0fb4Kr9-k0fAmJFYWh=xbDjZQ@mail.gmail.com> <CAFj8pRBmDcB_0nMQp4uiyV6XMZTh3xAhARRyiatR=7ZELyq0+g@mail.gmail.com> <11642.1511116381@sss.pgh.pa.us> <1511143938357-0.post@n3.nabble.com> <14909.1511149684@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox