Re: [RFC] Unsigned integer support.

From: Gregory Stark <stark(at)enterprisedb(dot)com>
To: "Decibel!" <decibel(at)decibel(dot)org>
Cc: "Alvaro Herrera" <alvherre(at)commandprompt(dot)com>, "Ryan Bradetich" <rbradetich(at)gmail(dot)com>, "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>, <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [RFC] Unsigned integer support.
Date: 2008-07-28 22:54:28
Message-ID: 87fxptsjq3.fsf@oxford.xeocode.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

"Decibel!" <decibel(at)decibel(dot)org> writes:

> On Jul 25, 2008, at 11:44 AM, Alvaro Herrera wrote:
>> However, it would be neat if this behaved the same as
>>
>> alvherre=# select '0.42' + 1;
>> ERROR: invalid input syntax for integer: "0.42"
>> STATEMENT: select '0.42' + 1;
>
>
> Do we really want to be making it easier for people to wrap numbers in quotes?

Currently wrapping numbers in quotes is really the way Postgres expects to get
them. Quoted constants in Postgres are just "unknown" type which are parsed
according to context. Unquoted constants in Postgres are assigned a type by
the parser based on what they look like and then have to be cast to something
else if that turns out to be the wrong data type.

I think people from other languages expect quoted constants to be strings and
they often go out of their way to avoid them (causing themselves headaches
when they then need to deal with casting rules).

--
Gregory Stark
EnterpriseDB http://www.enterprisedb.com
Get trained by Bruce Momjian - ask me about EnterpriseDB's PostgreSQL training!

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2008-07-28 23:04:14 Re: WITH RECUSIVE patches 0723
Previous Message Tom Lane 2008-07-28 22:48:24 Re: Do we really want to migrate plproxy and citext into PG core distribution?