Re: [HACKERS] numeric data type on 6.5

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Thomas Lockhart <lockhart(at)alumni(dot)caltech(dot)edu>
Cc: Jan Wieck <jwieck(at)debis(dot)com>, hackers(at)postgreSQL(dot)org
Subject: Re: [HACKERS] numeric data type on 6.5
Date: 1999-05-05 14:56:57
Message-ID: 2638.925916217@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Thomas Lockhart <lockhart(at)alumni(dot)caltech(dot)edu> writes:
> Seems to do OK with numeric tokens of unspecified type which will
> become int8 and numeric in the parser. There may be some edge-effect
> cases (e.g. decimal data with 17 characters) which aren't quite right.
> Comments?

I'd suggest backing off one more place on the length of string you will
try to convert to a float8. Since the test is strlen() <= 17, you
actually can have at most 16 digits (there must be a decimal point in
there too). But IEEE float is only good to 16-and-change digits; I'm
not sure I'd want to assume that the 16th digit will always be
reproduced exactly. 15 digits would be safer.

It could still break if the C library's float<=>string conversion
routines are sloppy :-(. I suppose you're interested in preserving
the info that "this constant looks numeric-ish" to assist in type
resolution heuristics? Otherwise the value could be left in string
form till later.

Is there any value in marking the constant as a numeric token, yet
leaving its specific value as a string until after type resolution
is done?

regards, tom lane

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 1999-05-05 15:07:13 Re: [HACKERS] posmaster failed under high load
Previous Message Oleg Bartunov 1999-05-05 14:37:29 Re: [HACKERS] posmaster failed under high load