On Wed, Jan 28, 2015 at 8:27 AM, Rodrigo Lueneberg <lists@ruby-forum.com> wrote:
> OK, but if they are the same there would be no need for 2 different
> types under PostgreSQL database. According to the post link provided,
So you prefer to believe a 5-year-old SO post rather than actual
product documentation?
Up to you. Regardless, while I read it as numeric and decimal being
the same thing, you can test that theory yourself. Here's one way:
testdb=# create table things ( name varchar(255), price decimal );
testdb=# \dS things
Table "public.things"
Column | Type | Modifiers
--------+------------------------+-----------
name | character varying(255) |
price | numeric |
This is on a PG 9.3.5 installation, BTW; you didn't mention what
version you're running, so YMMV.
--
Hassan Schroeder ------------------------ hassan.schroeder@gmail.com
http://about.me/hassanschroeder
twitter: @hassan
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CACmC4yCO6AwZU6vYHDaTiODMPb_%3Dm%2BG0_5sxTd4xv5hot1TeoA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
OK, but if they are the same there would be no need for 2 different
types under PostgreSQL database. According to the post link provided,
decimal is more flexible allowing to store less decimal as opposed to
numeric which requires all decimal places to be filled in. This means
that using decimal I could stored the numbers 12345.12345 as well as
12345.12. In the other hand, numeric would only accept 12345.12345 or
12345.12000 if I understood it right.
--
Posted via http://www.ruby-forum.com/.
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/0b0da127333cae2a4d0acc135aafb853%40ruby-forum.com.
For more options, visit https://groups.google.com/d/optout.
On Wed, Jan 28, 2015 at 6:03 AM, Rodrigo Lueneberg <lists@ruby-forum.com> wrote:
> According to this post:
> http://stackoverflow.com/questions/1841915/difference-betweeen-decimal-and-numeric
> I found that there is a slight difference between decimal type and
> numeric type:
Via: http://www.postgresql.org/docs/9.4/static/datatype-numeric.html
"The types decimal and numeric are equivalent. Both types are part of
the SQL standard."
HTH,
--
Hassan Schroeder ------------------------ hassan.schroeder@gmail.com
http://about.me/hassanschroeder
twitter: @hassan
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CACmC4yA%2BB0cVqOceePwCmhTjMMi6qfqJh5R7woRtofFwh%2Bxxhw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.