Re: NUMERIC and arithmetics - Mailing list pgsql-general

From Christoph Dalitz
Subject Re: NUMERIC and arithmetics
Date
Msg-id 20020919152516.3062958c.christoph.dalitz@hs-niederrhein.de
Whole thread Raw
In response to Re: NUMERIC and arithmetics  (Martijn van Oosterhout <kleptog@svana.org>)
Responses Re: NUMERIC and arithmetics
List pgsql-general
On Thu, 19 Sep 2002 22:57:28 +1000
Martijn van Oosterhout <kleptog@svana.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

pgsql-general by date:

Previous
From: Chris Bowlby
Date:
Subject: Re: array issue....
Next
From: "Robert Treat"
Date:
Subject: Re: [HACKERS] PGXLOG variable worthwhile?