SV: [HACKERS] Re: [BUGS] agregate function sum error

From: "Mattias Kregert" <matti(at)algonet(dot)se>
To: <sferac(at)bo(dot)nettuno(dot)it>
Cc: <hackers(at)postgreSQL(dot)org>
Subject: SV: [HACKERS] Re: [BUGS] agregate function sum error
Date: 1998-02-24 13:32:35
Message-ID: 199802241234.HAA14917@hub.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> End users hate uneccessaries or non sense messages like the following
> when he/she writes a sentence like this:
>
> UPDATE my_table SET my_int=my_small;
>
> and PostgreSQL show him/her this message ?
> ---------------------------------------------------------------------
> WARN: type of my_small does not match target column my_int
> ---------------------------------------------------------------------
> - What message is this ? If PostgreSQL understand that I want to do:
> UPDATE my_table SET my_int=my_small::int4;
> why it doesn't do that for me?
>
> SELECT my_small * my_float FROM my_table;
> ---------------------------------------------------------------------
> NOTICE:there is no operator * for types int2 and float8
> NOTICE:You will either have to retype this query using an
> NOTICE:explicit cast, or you will have to define the operator
> WARN:* for int2 and float8 using CREATE OPERATOR
> ---------------------------------------------------------------------
>
> - Well, if PostgreSQL know what I want why it doesn't do it for me ?
> I know that conversion is more expensive than warnning but it's more
> friendly. What do you think? ;-)

Yes, this is very annoying. If I do:
psql=> select my_small * my_float from my_table;

then my_small should be promoted to float automagically.

PostgreSQL should rewrite this as "select my_small::float * my_float from
my_table"
so that numeric expressions always returns the "biggest" type involved.
In most programmig languages, this is done automatically, and should be
done
in PostgreSQL for all calculations.

/* m */

Browse pgsql-hackers by date

  From Date Subject
Next Message Frank Ridderbusch 1998-02-24 13:39:40 Using the -u switch for diff in regress.sh
Previous Message Thomas G. Lockhart 1998-02-24 13:29:27 Re: [HACKERS] Re: [BUGS] agregate function sum error