Re: NUMERIC and arithmetics

From: Christoph Dalitz <christoph(dot)dalitz(at)hs-niederrhein(dot)de>
To: Martijn van Oosterhout <kleptog(at)svana(dot)org>
Cc: PG Mailing List <pgsql-general(at)postgresql(dot)org>
Subject: Re: NUMERIC and arithmetics
Date: 2002-09-19 13:25:16
Message-ID: 20020919152516.3062958c.christoph.dalitz@hs-niederrhein.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Thu, 19 Sep 2002 22:57:28 +1000
Martijn van Oosterhout <kleptog(at)svana(dot)org> wrote:
> >
> > ERROR: Unable to identify an operator '>' for types 'numeric' and 'float8'
> >
> > preis is typed NUMERIC(8,2). Strangely, "preis > 3" works.
> >
>
> If you do:
>
> delete from produkt where preis > '3.00';
>
> it works fine. I'm thinking we could save ourselves a lot of hassle by
> requiring all constants to be quoted :)
>
This is strange. I thought '3.00' would be a string constant, ie. of type
VARCHAR. In Oracle 3.00 is a number constant and '3.00' a string constant
which needs to be explicitly converted with to_number().

Does this mean that string constants in PostgreSQL are implicitly cast to
numeric when '>' is used? Or is preis implicitly cast to VARCHAR and the
comparison is not done numeric but according to the ASCII table?

Christoph Dalitz

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Robert Treat 2002-09-19 13:28:51 Re: [HACKERS] PGXLOG variable worthwhile?
Previous Message Chris Bowlby 2002-09-19 13:12:47 Re: array issue....