Re: [HACKERS] numeric data type on 6.5
От | Tom Lane |
---|---|
Тема | Re: [HACKERS] numeric data type on 6.5 |
Дата | |
Msg-id | 2638.925916217@sss.pgh.pa.us обсуждение исходный текст |
Ответ на | Re: [HACKERS] numeric data type on 6.5 (Thomas Lockhart <lockhart@alumni.caltech.edu>) |
Список | pgsql-hackers |
Thomas Lockhart <lockhart@alumni.caltech.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
В списке pgsql-hackers по дате отправления: