debugsqlModerate
ERROR: invalid input syntax for type money
Viewed 0 times
moneyerrorsyntaxinputtypeforinvalid
Problem
While importing I get this error:
This is Heroku's PostgreSQL Dump database.
PostgreSQL version on Heroku is 9.3.15 and the same on my system
The command I used:
Could anyone suggest a solution?
pg_restore: [archiver (db)] COPY failed for table "transaction_details":
ERROR: invalid input syntax for type money: "$0.00"restore completed, but the transaction_details table is empty.This is Heroku's PostgreSQL Dump database.
PostgreSQL version on Heroku is 9.3.15 and the same on my system
The command I used:
pg_restore --verbose --clean --no-acl --no-owner -h localhost -U root -d database 577b86e3-8d96-4410-9b36-dd0f78cfe32f
Could anyone suggest a solution?
Solution
The manual about the
Since the output of this data type is locale-sensitive, it might not
work to load
of
database make sure
the database that was dumped.
To check:
The manual on
The example value in the error message (
You can set it in
This peculiar behavior is one of the reasons why the
money type has advice for your case exactly:Since the output of this data type is locale-sensitive, it might not
work to load
money data into a database that has a different settingof
lc_monetary. To avoid problems, before restoring a dump into a newdatabase make sure
lc_monetary has the same or equivalent value as inthe database that was dumped.
To check:
SHOW lc_monetary;The manual on
lc_monetary. The example value in the error message (
'$0.00') would work with the default setting (among others):lc_monetary = 'C';You can set it in
postgresql.conf, reload and try again ...This peculiar behavior is one of the reasons why the
money type is unpopular.Code Snippets
SHOW lc_monetary;lc_monetary = 'C';Context
StackExchange Database Administrators Q#159536, answer score: 12
Revisions (0)
No revisions yet.