Migrating money column from MS SQL Server to Postgres

From: "Igal (at) Lucee(dot)org" <igal(at)lucee(dot)org>
To: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Migrating money column from MS SQL Server to Postgres
Date: 2017-11-09 00:32:56
Message-ID: 8acca674-ac7c-2b48-9a3e-8b8acf8b2c36@lucee.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hello,

I am migrating a database from MS SQL Server to Postgres.

I have a column named "discount" of type money in SQL Server.  I created
the table in Postgres with the same name and type, since Postgres has a
type named money, and am transferring the data by using PDI (Pentaho
Data Integration) Kettle/Spoon.

Kettle throws an error though:  column "discount" is of type money but
expression is of type double precision.

The value in the offending insert is:  0.0

Why does Postgres decide that 0.0 is "double precision" (which is a
weird name in my opinion -- why can't it just be double) and not money?

I have control over the SELECT but not over the INSERT.  Is there any
way to set the cast the value on the SELECT side in MS SQL Server to
specify the column type of Postgres-money?

The only solution I found is to set the column in Postgres to DOUBLE
PRECISION instead of MONEY, but I'm not sure if there are negative side
effects to that?

Igal Sapir
Lucee Core Developer
Lucee.org <http://lucee.org/>

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2017-11-09 00:45:01 Re: Migrating money column from MS SQL Server to Postgres
Previous Message John R Pierce 2017-11-08 23:24:55 Re: database size changed after restoring using pg_restore