pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Igal @ Lucee.org <igal@lucee.org>
To: Postgres General Postgres General <pgsql-general@postgresql.org>
Subject: Re: Migrating money column from MS SQL Server to Postgres
Date: Wed, 8 Nov 2017 22:58:04 -0800
Message-ID: <724bab58-87d9-7b02-867b-5d98b93aac7d@lucee.org> (raw)
In-Reply-To: <fdf92d62-c165-e6f3-9a22-dbb562b5afd4@lucee.org>
References: <8acca674-ac7c-2b48-9a3e-8b8acf8b2c36@lucee.org>
	<4497.1510188301@sss.pgh.pa.us>
	<CAF3N6oS3REmTvwimqhRm0oikyncTUoiQ23sHKYrXJENxcW7JvA@mail.gmail.com>
	<4b6a0bfb-0cbc-b407-feaa-0be86f06e4d9@lucee.org>
	<CAF3N6oQow_Bj8P6Y1f+rw00yTrK6ncvmqF2xCSvWwNJ6+ua7uA@mail.gmail.com>
	<fdf92d62-c165-e6f3-9a22-dbb562b5afd4@lucee.org>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-general>

On 11/8/2017 6:25 PM, Igal @ Lucee.org wrote:
> On 11/8/2017 5:27 PM, Allan Kamau wrote:
>> Maybe using NUMERIC without explicitly stating the precision is 
>> recommended. This would allow for values with many decimal places to 
>> be accepted without truncation. Your field may need to capture very 
>> small values such as those in bitcoin trading or some banking fee or 
>> interest.
>
> That's a very good idea.  For some reason I thought that I tried that 
> earlier and it didn't work as expected, but I just tested it (again?) 
> and it seems to work well, so that's what I'll do.

Another weird thing that I noticed:

On another column, "total_charged", that was migrated properly as a 
`money` type, when I run `sum(total_charged::money)` I get `null`, but 
if I cast it to numeric, i.e. `sum(total_charged::numeric)`, I get the 
expected sum result.

Is there a logical explanation to that?


Igal


-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general



view thread (12+ messages)  latest in thread

Message-ID: <724bab58-87d9-7b02-867b-5d98b93aac7d@lucee.org>
Permalink:  ../724bab58-87d9-7b02-867b-5d98b93aac7d@lucee.org/
Also on:    postgresql.org/message-id/724bab58-87d9-7b02-867b-5d98b93aac7d@lucee.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: igal@lucee.org
  Subject: Re: Migrating money column from MS SQL Server to Postgres
  In-Reply-To: <724bab58-87d9-7b02-867b-5d98b93aac7d@lucee.org>
  References: <8acca674-ac7c-2b48-9a3e-8b8acf8b2c36@lucee.org> <4497.1510188301@sss.pgh.pa.us> <CAF3N6oS3REmTvwimqhRm0oikyncTUoiQ23sHKYrXJENxcW7JvA@mail.gmail.com> <4b6a0bfb-0cbc-b407-feaa-0be86f06e4d9@lucee.org> <CAF3N6oQow_Bj8P6Y1f+rw00yTrK6ncvmqF2xCSvWwNJ6+ua7uA@mail.gmail.com> <fdf92d62-c165-e6f3-9a22-dbb562b5afd4@lucee.org> <724bab58-87d9-7b02-867b-5d98b93aac7d@lucee.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox