2

We have a production server on windows with a PostgreSQL database described as:

LC_COLLATE = 'Portuguese_Brazil.1252'
LC_CTYPE = 'Portuguese_Brazil.1252'

The thing is, when we work on our development machines, which are all CentOS, the PostgreSQL installation only allow us to create databases on this format:

LC_COLLATE = 'en_US.UTF8'
LC_CTYPE = 'en_US.UTF8'

or

LC_COLLATE = 'pt_BR.UTF8'
LC_CTYPE = 'pt_BR.UTF8'

This is affecting the way we store dates and timestamps on each one of them.
How can i replicate the collation of the windows database on the centOS machine? The other way around can be a solution too.

1
  • Dates and timestamps aren't stored with a specific format. Commented Mar 14, 2013 at 13:30

1 Answer 1

1

You can set the date format in postgresql.conf:

datestyle = 'iso, mdy'

Adjust the mdy part. Look at Locale and Formatting

How are the dates entered? If the date input format starts with a four digits year it is unambiguous:

'2013-03-14 10:19'

Try to use that format everywhere. Check the date input format details

As commented by @a_horse the date stored format is always the same, a binary. What you can configure is the input and output format.

Sign up to request clarification or add additional context in comments.

3 Comments

The timestamps are being entered in the format: dd/mm/YYYY H:M:S. The thing is, in the windows database it saves correctly, but on centOS databases it show an out of range error, possibly due to the date format.
@MurifoX Then use datestyle = 'iso, dmy' in the CentOS server.
You could as I'm in Brasília but I don't like cerveja goiana as it always come with those sertanejo songs :)))

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.