Thread: Numeric and Aggregate: transform node 107

Numeric and Aggregate: transform node 107

From
Michael Contzen
Date:
Hallo,
 
first of all, thank you for fixing the ´hash table overflow problem´, I´ve tested it on a join between a 2GB and a 3MB table, it works!
 
Now, I tried to use the numeric type, and hit the following problem:
 
create table a (val numeric(10,2));
CREATE
insert into a values('123.45');
INSERT 2402633 1
 
create table b (val numeric(10,2));
CREATE

insert into b select sum(val) into b;
ERROR: transformExpr: does not know how to transform node 107

insert into b select float8(sum(val)) into b;
INSERT 2402643 1
 
One other (SQL-) question: How can I cast results to numeric directly? Using float8 cast and the following implicit cast is not very nice.
 
Kind regards,
 
Michael Contzen
Dohle Systemberatung, Germany

 

Re: [HACKERS] Numeric and Aggregate: transform node 107

From
Tom Lane
Date:
Michael Contzen <mcontzen@dohle.com> writes:
> insert into b select sum(val) into b;
> ERROR:  transformExpr: does not know how to transform node 107

I fixed that error a few days ago (the parser wasn't coping with
implicit type coercion of aggregates).  It works here:

regression=> insert into b select sum(val) into b;
INSERT 540179 1

I'm a little confused about why this statement is allowed, though;
shouldn't it read 'insert into b select sum(val) FROM a'?

I'm not sure what the parser thought it was doing --- there's no
need for a type coercion if it's computing a sum() of a numeric
column and putting the result in another numeric column, so I have
a suspicion that the parser read the statement as meaning something
else entirely.
        regards, tom lane