Re: Select-into, count error (stored function).

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Michael Weaver <mweaver(at)corpusglobe(dot)com>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: Select-into, count error (stored function).
Date: 2003-02-17 06:21:44
Message-ID: 2267.1045462904@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

Michael Weaver <mweaver(at)corpusglobe(dot)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

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message Sudheesh Krishnankutty 2003-02-17 08:20:27 How to copy database
Previous Message Michael Weaver 2003-02-17 06:19:22 Select-into, count error (stored function).