I am addressing an issue where I cannot copy data to postgresql in Rails because the date format is not in matching the default postgresql ISO MDY.
On my local machine I just changed the datestyle to European so that my DMY data matches correctly.
As usual, its not as easy to do this on the Heroku production server. Using the steps below I try to change the datestyle, which works, but it doesn't persist (as shown by exiting, going back in and asking postgres to show me the datestyle).
Any ideas how I can persist this. All research has show not to do this and to change my code to convert the data to MDY but I am pulling millions of rows from a legacy system that defaults as DMY and using a postgresql copy command to do this the fastest way possible. Seems easier to just tell Postgresql to change datestyle than fix everything else :/
$ heroku pg:psql
app-name::CRIMSON=> SET datestyle TO 'european';
SET
app-name::CRIMSON=> SHOW datestyle;
DateStyle
-----------
ISO, DMY
(1 row)
app-name::CRIMSON-> \q
$ heroku pg:psql
---> Connecting to HEROKU_POSTGRESQL_CRIMSON_URL (DATABASE_URL)
psql (9.4.1, server 9.3.6)
SSL connection (protocol: TLSv1.2, cipher: jibberish, bits: 256, compression: off)
Type "help" for help.
app-name::CRIMSON=> SHOW datestyle;
DateStyle
-----------
ISO, MDY
(1 row)