PL/PGSQL bug when using aggregates (repost)

From: Michael Contzen <mcontzen(at)dohle(dot)com>
To: "'pgsql-hackers(at)postgresql(dot)org'" <pgsql-hackers(at)postgresql(dot)org>
Subject: PL/PGSQL bug when using aggregates (repost)
Date: 1999-01-06 08:51:17
Message-ID: 01BE3951.B9AD2920@wcontzen.dohle.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hello,

case of your majordomo problems this message seems to be lost. So this repost ...

Hello there,

I have a problem using pl/pgsql (distributed in version 6.4.1).
We are using PostgreSQL for an ordering-system as a part of a new data warehouse. At this moment we have about 10K rows and it works great!
Now we are testing it for a much amount of data (sales report) of about 1.5GB in size.
My first question is: is this the right place to post such bug reports?
Ok, following pl/pgsql statements doesn´t work:

--------
create table t1 (i int, a int, b int);
CREATE create table t2 (i int, x int, y int);
CREATE
insert into t1 values(1, 1,10);
INSERT 35140214 1 insert into t1 values(1, 2,10);
INSERT 35140215 1 insert into t1 values(2, 3,10);
INSERT 35140216 1 insert into t1 values(2, 4,10);
INSERT 35140217 1
create function func1()
returns int
as '
declare
begin
insert into t2
select i,
sum(a) as x,
sum(b) as y
from t1
group by i;
return 1;
end;
' language 'plpgsql';
CREATE

select func1();
func1
-----
1
(1 row)

select * from t2;
i| x| y
-+--+--
1|20|20
2|20|20
(2 rows)

The result of the last column seems to be pasted in all other agregated columns.
-------------

Using the insert/select-statement directly (via psql) it works fine.
And one additional (last) question:
In pl/sql writing select * into table2 from table1 ... seems to be interpreted that table2 is a pl/sql-variable and not a table. So it doesn´t work. Is it a bug or is there an other way to select directly into a (new) table.

Kind regards
Michael Contzen
Dohle Handelsgruppe Systemberatung GmbH,
Germany

Browse pgsql-hackers by date

  From Date Subject
Next Message Jan Wieck 1999-01-06 10:03:33 Re: [HACKERS] Re: [GENERAL] Views
Previous Message Billy G. Allie 1999-01-06 08:18:12 Re: Stale porting list?