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






Wed, 6 Jan 1999 08:51:17 -0000
Michael Contzen <mcontzen@dohle.com>
PL/PGSQL bug when using aggregates (repost)