简体   繁体   中英

PostgreSQL datestyle altering

I am busy trying to transfer a PostgreSQL database however I noticed that when I do a backup export of the PostgreSQL database it outputs the dates as Y/m/d.

I did the set datestyle = 'ISO, DMY' previously and when I do inserts I can insert the date as DMY

insert into tablename (datefield)
values ('30-12-2015');

which works and to double check I used show datestyle and I did get

"ISO, DMY"

but when I do a select from the table I see the datetime as

'2015-12-30'

which it is backing up as so when I try to load it into a database that uses DMY it is failing

Why is this and how I get the data being stored into the database to be DMY so that when I select from a table I see?

'30-12-2015'

It seems I've found the solution, to see the date in the database using the DMY format I had to run

set datestyle = 'SQL, DMY'

instead of

set datestyle = 'ISO, DMY'

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM