Re: On using doubles as primary keys
| От | Jim Nasby |
|---|---|
| Тема | Re: On using doubles as primary keys |
| Дата | |
| Msg-id | 55315323.8010306@BlueTreble.com обсуждение исходный текст |
| Ответ на | Re: On using doubles as primary keys (Ray Cote <rgacote@appropriatesolutions.com>) |
| Список | pgsql-general |
On 4/17/15 1:10 PM, Ray Cote wrote: > > > (Not an IEEE floating point expert, but...) I've learned the hard way to > never rely on comparing two floating point numbers for equality -- and > that's what you are doing if you join on them as primary keys. If you > must use the underlying numeric data for joining, I'd recommend you do > something like: > * output the value to a string (rounded to a specific number of digits) > * use the textual representation of the number as your primary key. numeric would probably be more efficient, if you can use that instead. It does suffer from some of the same issues as floating point (there's been recent discussion of that on -hackers), but I believe it'd be better than double. -- Jim Nasby, Data Architect, Blue Treble Consulting Data in Trouble? Get it in Treble! http://BlueTreble.com
В списке pgsql-general по дате отправления: