PL/PGSQL bug using aggregates - Mailing list pgsql-hackers

From Michael Contzen
Subject PL/PGSQL bug using aggregates
Date
Msg-id 01BE38C6.8A811CF0@wcontzen.dohle.com
Whole thread Raw
List pgsql-hackers
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
andit 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 'declarebegin 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)

-------------

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
nota 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







pgsql-hackers by date:

Previous
From: "Thomas G. Lockhart"
Date:
Subject: Re: [HACKERS] FOR SHARE LOCK clause ?
Next
From: Vadim Mikheev
Date:
Subject: Re: [HACKERS] FOR SHARE LOCK clause ?