3

We are getting the following error from some of our users:

DataError: time zone "Asia/Qostanay" not recognized

We've found out that the problem was coming from the following SQL query:

SELECT * 
FROM "app_foobar" 
WHERE (
    EXTRACT('hour' FROM "app_foobar"."date" AT TIME ZONE 'Asia/Qostanay') = 0
);

1 Answer 1

3

There are two problems:

  1. Timezone definitions change over time. Update Ubuntu timezone data:
    sudo apt-get update
    sudo apt-get install tzdata
    
  2. Postgres 11.1 doesn't support this timezone (and some others). Update Postgres to 11.4:
    sudo apt-get update
    sudo apt-get install postgresql-11
    sudo apt-get install postgresql-client-11
    

Some notes on updating Postgres:

  1. No data migration needed for minor versions (e.g. 11.0 -> 11.4). Only executables are updated.
  2. PostgreSQL will restart (database will be unavailable for a second or two)

The relevant postgresql changelog (https://www.postgresql.org/docs/release/11.2/):

Update time zone data files to tzdata release 2018i for DST law changes in Kazakhstan, Metlakatla, and Sao Tome and Principe. Kazakhstan's Qyzylorda zone is split in two, creating a new zone Asia/Qostanay, as some areas did not change UTC offset. Historical corrections for Hong Kong and numerous Pacific islands.

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

Comments

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.