Re: Select-into, count error (stored function). - Mailing list pgsql-novice

From Tom Lane
Subject Re: Select-into, count error (stored function).
Date
Msg-id 2267.1045462904@sss.pgh.pa.us
Whole thread Raw
In response to Select-into, count error (stored function).  (Michael Weaver <mweaver@corpusglobe.com>)
List pgsql-novice
Michael Weaver <mweaver@corpusglobe.com> writes:

>         FOR count IN 1..size LOOP

>             SELECT    tbl_prdcrd.fld_prdcrd_id,
>                 tbl_prdcrd.fld_prdcrd_title,
>         ->        count (tbl_tranitem.fld_tranitem_productid),
> <-
>                 sum (tbl_tranitem.fld_tranitem_price *
> tbl_tranitem.fld_tranitem_quantity),

I think the problem is that you've used "count" as the loop variable
name.  The plpgsql parser is probably substituting a variable reference
for the "count" that you intend as an aggregate function name.  Use a
different name for the loop variable.


[ beware, off-topic rant ahead ]

> This email is intended only for the use of the individual or entity named
> above and may contain information that is confidential. If you are not the
> intended recipient, you are hereby notified that any dissemination,
> distribution or copying of this email is strictly prohibited. When addressed
> to our clients, any opinions or advice contained in this email are subject
> to the terms and conditions expressed in the governing Corpus Globe client
> engagement letter. If you have received this Email in error, please notify
> us immediately by return email or telephone +61 8 9331 2700 and destroy the
> original message. Thank You.

Do your company's lawyers really expect anyone to take this seriously in
a message sent to a public mailing list?  Perhaps I shall call that
number and tell them they look like utter fools.

            regards, tom lane

pgsql-novice by date:

Previous
From: Michael Weaver
Date:
Subject: Select-into, count error (stored function).
Next
From: Sudheesh Krishnankutty
Date:
Subject: How to copy database