Обсуждение: Empty ./share/timezone/UTC and failure to set UTC as timezone
Hello,
we are using "embedded" PostgreSQL for integration tests (see https://github.com/yandex-qatools/postgresql-embedded) and we have noticed that our (java) clients fail to connect when their timezone is UTC, with PG server giving following error message:
invalid value for parameter "TimeZone": "UTC"
To double check, I took official 9.6.7 sources, compiled and installed it locally (/tmp/pgsql) and tried connecting with client again and I again we got same error message.
postgres=# set timezone='UTC';
ERROR: invalid value for parameter "TimeZone": "UTC"
In order to further investigate this, I have attached strace on backend and I have noticed that PG is able to find and read file ./share/timezone/UTC. But right after reading the file, we get error message from above.
We noticed that UTC file is empty! Is this on purpose or is this is bug? Am I missing something?
Kind Regards,
Sasa Vilic
Sasa Vilic <sasavilic@gmail.com> writes: > To double check, I took official 9.6.7 sources, compiled and installed it > locally (/tmp/pgsql) and tried connecting with client again and I again we > got same error message. Hm, what platform and compiler are you using, exactly? > In order to further investigate this, I have attached strace on backend and > I have noticed that PG is able to find and read file ./share/timezone/UTC. > But right after reading the file, we get error message from above. > We noticed that UTC file is empty! Is this on purpose or is this is bug? Am > I missing something? It should certainly not be empty. On my machine it's 127 bytes long: $ ls -l share/timezone/UTC -rw-r--r--. 6 postgres postgres 127 Feb 19 12:27 share/timezone/UTC and file(1) knows what it is: $ file share/timezone/UTC share/timezone/UTC: timezone data, version 2, 1 gmt time flag, 1 std time flag, no leap seconds, no transition times, 1 abbreviationchar I wonder if you've tripped over some portability issue in the zic compiler. Another idea, seeing that this file is multiply-linked in the timezone install tree, is that maybe you're on a filesystem that does strange things with hard links. It'd be interesting to see the rest of your timezone directory. Mine looks like total 248 drwxr-xr-x. 2 postgres postgres 4096 Feb 19 12:27 Africa drwxr-xr-x. 6 postgres postgres 4096 Feb 19 12:27 America drwxr-xr-x. 2 postgres postgres 4096 Feb 19 12:27 Antarctica drwxr-xr-x. 2 postgres postgres 4096 Feb 19 12:27 Arctic drwxr-xr-x. 2 postgres postgres 4096 Feb 19 12:27 Asia drwxr-xr-x. 2 postgres postgres 4096 Feb 19 12:27 Atlantic drwxr-xr-x. 2 postgres postgres 4096 Feb 19 12:27 Australia drwxr-xr-x. 2 postgres postgres 4096 Feb 19 12:27 Brazil -rw-r--r--. 1 postgres postgres 2102 Feb 19 12:27 CET -rw-r--r--. 1 postgres postgres 2294 Feb 19 12:27 CST6CDT drwxr-xr-x. 2 postgres postgres 4096 Feb 19 12:27 Canada drwxr-xr-x. 2 postgres postgres 4096 Feb 19 12:27 Chile -rw-r--r--. 2 postgres postgres 2437 Feb 19 12:27 Cuba -rw-r--r--. 1 postgres postgres 1876 Feb 19 12:27 EET -rw-r--r--. 1 postgres postgres 127 Feb 19 12:27 EST -rw-r--r--. 1 postgres postgres 2294 Feb 19 12:27 EST5EDT -rw-r--r--. 2 postgres postgres 1972 Feb 19 12:27 Egypt -rw-r--r--. 2 postgres postgres 3543 Feb 19 12:27 Eire drwxr-xr-x. 2 postgres postgres 4096 Feb 19 12:27 Etc drwxr-xr-x. 2 postgres postgres 4096 Feb 19 12:27 Europe -rw-r--r--. 1 postgres postgres 148 Feb 19 12:27 Factory -rw-r--r--. 7 postgres postgres 3687 Feb 19 12:27 GB -rw-r--r--. 7 postgres postgres 3687 Feb 19 12:27 GB-Eire -rw-r--r--. 10 postgres postgres 127 Feb 19 12:27 GMT -rw-r--r--. 10 postgres postgres 127 Feb 19 12:27 GMT+0 -rw-r--r--. 10 postgres postgres 127 Feb 19 12:27 GMT-0 -rw-r--r--. 10 postgres postgres 127 Feb 19 12:27 GMT0 -rw-r--r--. 10 postgres postgres 127 Feb 19 12:27 Greenwich -rw-r--r--. 1 postgres postgres 128 Feb 19 12:27 HST -rw-r--r--. 2 postgres postgres 1189 Feb 19 12:27 Hongkong -rw-r--r--. 2 postgres postgres 1188 Feb 19 12:27 Iceland drwxr-xr-x. 2 postgres postgres 4096 Feb 19 12:27 Indian -rw-r--r--. 2 postgres postgres 1718 Feb 19 12:27 Iran -rw-r--r--. 3 postgres postgres 2265 Feb 19 12:27 Israel -rw-r--r--. 2 postgres postgres 507 Feb 19 12:27 Jamaica -rw-r--r--. 2 postgres postgres 318 Feb 19 12:27 Japan -rw-r--r--. 2 postgres postgres 259 Feb 19 12:27 Kwajalein -rw-r--r--. 2 postgres postgres 655 Feb 19 12:27 Libya -rw-r--r--. 1 postgres postgres 2102 Feb 19 12:27 MET -rw-r--r--. 1 postgres postgres 127 Feb 19 12:27 MST -rw-r--r--. 1 postgres postgres 2294 Feb 19 12:27 MST7MDT drwxr-xr-x. 2 postgres postgres 4096 Feb 19 12:27 Mexico -rw-r--r--. 4 postgres postgres 2460 Feb 19 12:27 NZ -rw-r--r--. 2 postgres postgres 2087 Feb 19 12:27 NZ-CHAT -rw-r--r--. 4 postgres postgres 2453 Feb 19 12:27 Navajo -rw-r--r--. 5 postgres postgres 414 Feb 19 12:27 PRC -rw-r--r--. 1 postgres postgres 2294 Feb 19 12:27 PST8PDT drwxr-xr-x. 2 postgres postgres 4096 Feb 19 12:27 Pacific -rw-r--r--. 2 postgres postgres 2705 Feb 19 12:27 Poland -rw-r--r--. 2 postgres postgres 3453 Feb 19 12:27 Portugal -rw-r--r--. 2 postgres postgres 790 Feb 19 12:27 ROC -rw-r--r--. 2 postgres postgres 531 Feb 19 12:27 ROK -rw-r--r--. 2 postgres postgres 424 Feb 19 12:27 Singapore -rw-r--r--. 3 postgres postgres 2166 Feb 19 12:27 Turkey -rw-r--r--. 2 postgres postgres 127 Feb 19 12:27 UCT drwxr-xr-x. 2 postgres postgres 4096 Feb 19 12:27 US -rw-r--r--. 6 postgres postgres 127 Feb 19 12:27 UTC -rw-r--r--. 6 postgres postgres 127 Feb 19 12:27 Universal -rw-r--r--. 2 postgres postgres 1544 Feb 19 12:27 W-SU -rw-r--r--. 1 postgres postgres 1873 Feb 19 12:27 WET -rw-r--r--. 6 postgres postgres 127 Feb 19 12:27 Zulu -rw-r--r--. 3 postgres postgres 3545 Feb 19 12:27 posixrules regards, tom lane
Hi Tom,
thanks for quick response. I have to apologize to you, PG from source is fine. Sorry for wasting your time.
It only happens that after I put it into archive (tar czf postgresql-9.6.7-linux-x64-binaries.tar.gz pgsql) and extract it, that it is empty and it looks like it is a bug in java library implementation of tar.gz.
Once again, sorry for wasting your time. Thank you very much for your support.
Kind Regards,
Sasa Vilic
thanks for quick response. I have to apologize to you, PG from source is fine. Sorry for wasting your time.
It only happens that after I put it into archive (tar czf postgresql-9.6.7-linux-x64-binaries.tar.gz pgsql) and extract it, that it is empty and it looks like it is a bug in java library implementation of tar.gz.
Once again, sorry for wasting your time. Thank you very much for your support.
Kind Regards,
Sasa Vilic
2018-02-19 17:33 GMT+00:00 Tom Lane <tgl@sss.pgh.pa.us>:
Sasa Vilic <sasavilic@gmail.com> writes:
> To double check, I took official 9.6.7 sources, compiled and installed it
> locally (/tmp/pgsql) and tried connecting with client again and I again we
> got same error message.
Hm, what platform and compiler are you using, exactly?
> In order to further investigate this, I have attached strace on backend and
> I have noticed that PG is able to find and read file ./share/timezone/UTC.
> But right after reading the file, we get error message from above.
> We noticed that UTC file is empty! Is this on purpose or is this is bug? Am
> I missing something?
It should certainly not be empty. On my machine it's 127 bytes long:
$ ls -l share/timezone/UTC
-rw-r--r--. 6 postgres postgres 127 Feb 19 12:27 share/timezone/UTC
and file(1) knows what it is:
$ file share/timezone/UTC
share/timezone/UTC: timezone data, version 2, 1 gmt time flag, 1 std time flag, no leap seconds, no transition times, 1 abbreviation char
I wonder if you've tripped over some portability issue in the zic
compiler. Another idea, seeing that this file is multiply-linked
in the timezone install tree, is that maybe you're on a filesystem
that does strange things with hard links.
It'd be interesting to see the rest of your timezone directory. Mine
looks like
total 248
drwxr-xr-x. 2 postgres postgres 4096 Feb 19 12:27 Africa
drwxr-xr-x. 6 postgres postgres 4096 Feb 19 12:27 America
drwxr-xr-x. 2 postgres postgres 4096 Feb 19 12:27 Antarctica
drwxr-xr-x. 2 postgres postgres 4096 Feb 19 12:27 Arctic
drwxr-xr-x. 2 postgres postgres 4096 Feb 19 12:27 Asia
drwxr-xr-x. 2 postgres postgres 4096 Feb 19 12:27 Atlantic
drwxr-xr-x. 2 postgres postgres 4096 Feb 19 12:27 Australia
drwxr-xr-x. 2 postgres postgres 4096 Feb 19 12:27 Brazil
-rw-r--r--. 1 postgres postgres 2102 Feb 19 12:27 CET
-rw-r--r--. 1 postgres postgres 2294 Feb 19 12:27 CST6CDT
drwxr-xr-x. 2 postgres postgres 4096 Feb 19 12:27 Canada
drwxr-xr-x. 2 postgres postgres 4096 Feb 19 12:27 Chile
-rw-r--r--. 2 postgres postgres 2437 Feb 19 12:27 Cuba
-rw-r--r--. 1 postgres postgres 1876 Feb 19 12:27 EET
-rw-r--r--. 1 postgres postgres 127 Feb 19 12:27 EST
-rw-r--r--. 1 postgres postgres 2294 Feb 19 12:27 EST5EDT
-rw-r--r--. 2 postgres postgres 1972 Feb 19 12:27 Egypt
-rw-r--r--. 2 postgres postgres 3543 Feb 19 12:27 Eire
drwxr-xr-x. 2 postgres postgres 4096 Feb 19 12:27 Etc
drwxr-xr-x. 2 postgres postgres 4096 Feb 19 12:27 Europe
-rw-r--r--. 1 postgres postgres 148 Feb 19 12:27 Factory
-rw-r--r--. 7 postgres postgres 3687 Feb 19 12:27 GB
-rw-r--r--. 7 postgres postgres 3687 Feb 19 12:27 GB-Eire
-rw-r--r--. 10 postgres postgres 127 Feb 19 12:27 GMT
-rw-r--r--. 10 postgres postgres 127 Feb 19 12:27 GMT+0
-rw-r--r--. 10 postgres postgres 127 Feb 19 12:27 GMT-0
-rw-r--r--. 10 postgres postgres 127 Feb 19 12:27 GMT0
-rw-r--r--. 10 postgres postgres 127 Feb 19 12:27 Greenwich
-rw-r--r--. 1 postgres postgres 128 Feb 19 12:27 HST
-rw-r--r--. 2 postgres postgres 1189 Feb 19 12:27 Hongkong
-rw-r--r--. 2 postgres postgres 1188 Feb 19 12:27 Iceland
drwxr-xr-x. 2 postgres postgres 4096 Feb 19 12:27 Indian
-rw-r--r--. 2 postgres postgres 1718 Feb 19 12:27 Iran
-rw-r--r--. 3 postgres postgres 2265 Feb 19 12:27 Israel
-rw-r--r--. 2 postgres postgres 507 Feb 19 12:27 Jamaica
-rw-r--r--. 2 postgres postgres 318 Feb 19 12:27 Japan
-rw-r--r--. 2 postgres postgres 259 Feb 19 12:27 Kwajalein
-rw-r--r--. 2 postgres postgres 655 Feb 19 12:27 Libya
-rw-r--r--. 1 postgres postgres 2102 Feb 19 12:27 MET
-rw-r--r--. 1 postgres postgres 127 Feb 19 12:27 MST
-rw-r--r--. 1 postgres postgres 2294 Feb 19 12:27 MST7MDT
drwxr-xr-x. 2 postgres postgres 4096 Feb 19 12:27 Mexico
-rw-r--r--. 4 postgres postgres 2460 Feb 19 12:27 NZ
-rw-r--r--. 2 postgres postgres 2087 Feb 19 12:27 NZ-CHAT
-rw-r--r--. 4 postgres postgres 2453 Feb 19 12:27 Navajo
-rw-r--r--. 5 postgres postgres 414 Feb 19 12:27 PRC
-rw-r--r--. 1 postgres postgres 2294 Feb 19 12:27 PST8PDT
drwxr-xr-x. 2 postgres postgres 4096 Feb 19 12:27 Pacific
-rw-r--r--. 2 postgres postgres 2705 Feb 19 12:27 Poland
-rw-r--r--. 2 postgres postgres 3453 Feb 19 12:27 Portugal
-rw-r--r--. 2 postgres postgres 790 Feb 19 12:27 ROC
-rw-r--r--. 2 postgres postgres 531 Feb 19 12:27 ROK
-rw-r--r--. 2 postgres postgres 424 Feb 19 12:27 Singapore
-rw-r--r--. 3 postgres postgres 2166 Feb 19 12:27 Turkey
-rw-r--r--. 2 postgres postgres 127 Feb 19 12:27 UCT
drwxr-xr-x. 2 postgres postgres 4096 Feb 19 12:27 US
-rw-r--r--. 6 postgres postgres 127 Feb 19 12:27 UTC
-rw-r--r--. 6 postgres postgres 127 Feb 19 12:27 Universal
-rw-r--r--. 2 postgres postgres 1544 Feb 19 12:27 W-SU
-rw-r--r--. 1 postgres postgres 1873 Feb 19 12:27 WET
-rw-r--r--. 6 postgres postgres 127 Feb 19 12:27 Zulu
-rw-r--r--. 3 postgres postgres 3545 Feb 19 12:27 posixrules
regards, tom lane