Re: Real type with zero

Поиск
Список
Период
Сортировка
От David Johnston
Тема Re: Real type with zero
Дата
Msg-id 008c01cc3674$480cb3c0$d8261b40$@yahoo.com
обсуждение исходный текст
Ответ на Re: Real type with zero  (Grzegorz Jaśkiewicz <gryzman@gmail.com>)
Ответы Re: Real type with zero
Re: Real type with zero
Список pgsql-general
-----Original Message-----
From: pgsql-general-owner@postgresql.org [mailto:pgsql-general-owner@postgresql.org] On Behalf Of Grzegorz Jaskiewicz
Sent: Wednesday, June 29, 2011 7:44 AM
To: condor@stz-bg.com
Cc: pgsql-general@postgresql.org
Subject: Re: [GENERAL] Real type with zero

what you probably looking for is formatting the output into a string.
Postgresql will store it as 2.3, because that is what 2.30 is anyway.
Its up to you to format it before passing it on to the user/business logic/whatever.



I presume (and even if not) the OP is looking to keep the known precision of the value.  If I look at 2.3 I do not know
whetherI have precision of measurement only to the tenths or whether I had higher precision but all positions beyond
thetenths are zero. 

Aside from storing the "true" precision in a separate integer field what solution is there is this situation.  I guess
defining"numeric(S,P)" works although I haven't done much actual work with "precision" in the database and so I do not
knowwhether it is truly sufficient.  I would guess not since there may be cases where the known precision is less than
thedefined precision and so the numeric(S,P) data type will over specify the precision in those cases. 

This is beginning to sound like a varchar(n) versus text argument...

David J.



В списке pgsql-general по дате отправления:

Предыдущее
От: "Jonathan S. Katz"
Дата:
Сообщение: Re: point types in "DISTINCT" queries
Следующее
От: Jeff Davis
Дата:
Сообщение: Re: point types in "DISTINCT" queries