pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Björn Lundin <b.f.lundin@gmail.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Adrian Klaver <adrian.klaver@aklaver.com>
Cc: pgsql-general@postgresql.org
Subject: Re: Order by and timestamp
Date: Mon, 16 Mar 2020 22:28:54 +0100
Message-ID: <4C6CD383-ADC0-4529-82FF-2141568C09BB@gmail.com> (raw)
In-Reply-To: <8265.1584376814@sss.pgh.pa.us>
References: <63004F55-4CA3-40F8-A898-E7A646B0EBD3@gmail.com>
	<c171c26b-fd5e-b4bf-ec86-97b6f8dbcbe0@aklaver.com>
	<24142.1584319263@sss.pgh.pa.us>
	<7D74B8B5-DFBD-4B5B-85C6-A516343E49C1@gmail.com>
	<346C3B58-D29E-4CC2-8200-691ECA91F494@gmail.com>
	<10f84f23-6011-28ab-79a1-a1c259424d2e@aklaver.com>
	<72890A04-294E-4753-8839-69F0BAD9AA17@gmail.com>
	<8265.1584376814@sss.pgh.pa.us>



> 16 mars 2020 kl. 17:40 skrev Tom Lane <tgl@sss.pgh.pa.us>:
> 
> =?utf-8?Q?Bj=C3=B6rn_Lundin?= <b.f.lundin@gmail.com> writes:
>> Ooh - terrible sorry.
>> The output from first post describing the database schema
>> Was actually from my production machine - a raspberry pi.
>> The pi hold a db on an usb-disk, which is pg_dump()ed every night and imported to ibm2 history db (the bad one) 
> 
>> The schema is identical to the one with trouble - which is a history database
>> Intended for testing
> 
> Hmmm ... schema is evidently the same, but locale seemingly not.
> Is it possible this is a locale problem?  I did not look closely
> at the original data, but I'm suddenly wondering if it could be
> explained by misinterpreting the date field order (month-day vs
> day-month).  Check the datestyle settings on both machines.
> 
> 			regards, tom lane


But most of the output is correct. Like 95+% 
I found the bad ones by chance



The pi - keeping only data for 1 day then table exported and truncated every night 
(So there is not more than say max 60 records any given day)
Was only involved because I use it to describe the table

bnl@pibetbot:~ $ locale
LANG=en_GB.UTF-8
LANGUAGE=
LC_CTYPE="en_GB.UTF-8"
LC_NUMERIC="en_GB.UTF-8"
LC_TIME="en_GB.UTF-8"
LC_COLLATE="en_GB.UTF-8"
LC_MONETARY="en_GB.UTF-8"
LC_MESSAGES="en_GB.UTF-8"
LC_PAPER="en_GB.UTF-8"
LC_NAME="en_GB.UTF-8"
LC_ADDRESS="en_GB.UTF-8"
LC_TELEPHONE="en_GB.UTF-8"
LC_MEASUREMENT="en_GB.UTF-8"
LC_IDENTIFICATION="en_GB.UTF-8"
LC_ALL=

bnl@pibetbot:~ $ psql
Timing is on.
AUTOCOMMIT off
psql (9.6.10)
Type "help" for help.

bnl=# show datestyle;
 DateStyle 
-----------
 ISO, DMY



The faulty machine 
Ibm2 - linux debian pg-9.4
bnl@ibm2:~$ locale
LANG=sv_SE.UTF-8
LANGUAGE=
LC_CTYPE="sv_SE.UTF-8"
LC_NUMERIC="sv_SE.UTF-8"
LC_TIME="sv_SE.UTF-8"
LC_COLLATE="sv_SE.UTF-8"
LC_MONETARY="sv_SE.UTF-8"
LC_MESSAGES="sv_SE.UTF-8"
LC_PAPER="sv_SE.UTF-8"
LC_NAME="sv_SE.UTF-8"
LC_ADDRESS="sv_SE.UTF-8"
LC_TELEPHONE="sv_SE.UTF-8"
LC_MEASUREMENT="sv_SE.UTF-8"
LC_IDENTIFICATION="sv_SE.UTF-8"
LC_ALL=

bnl@ibm2:~$ psql
Tidtagning är på.
AUTOCOMMIT off
psql (9.6.15, server 9.4.15)
Skriv "help" för hjälp.

bnl=> show datestyle;
 DateStyle 
-----------
 ISO, YMD


The machine briefly mentioned with basically same dataset as faulty machine
Linux Ubuntu with pg-10.6 
bnl@tp:~$ locale
LANG=sv_SE.UTF-8
LANGUAGE=
LC_CTYPE="sv_SE.UTF-8"
LC_NUMERIC="sv_SE.UTF-8"
LC_TIME="sv_SE.UTF-8"
LC_COLLATE="sv_SE.UTF-8"
LC_MONETARY="sv_SE.UTF-8"
LC_MESSAGES="sv_SE.UTF-8"
LC_PAPER="sv_SE.UTF-8"
LC_NAME="sv_SE.UTF-8"
LC_ADDRESS="sv_SE.UTF-8"
LC_TELEPHONE="sv_SE.UTF-8"
LC_MEASUREMENT="sv_SE.UTF-8"
LC_IDENTIFICATION="sv_SE.UTF-8"
LC_ALL=

bnl@tp:~$ psql
Timing is on.
AUTOCOMMIT off
psql (10.6 (Ubuntu 10.6-0ubuntu0.18.04.1))
Type "help" for help.

bnl=# show datestyle;
 DateStyle 
-----------
 ISO, YMD



Both faulty (ibm2) and correct(tp) are populated with the same pg_dump()- files that r-pi produces every nigth

And for completeness - b info from the pi

bnl=# select version();
                                                       version                                                        
----------------------------------------------------------------------------------------------------------------------
 PostgreSQL 9.6.10 on armv7l-unknown-linux-gnueabihf, compiled by gcc (Raspbian 6.3.0-18+rpi1) 6.3.0 20170516, 32-bit
(1 row)

bnl@pibetbot:~ $ uname -a
Linux pibetbot 4.14.79-v7+ #1159 SMP Sun Nov 4 17:50:20 GMT 2018 armv7l GNU/Linux

--
Björn Lundin
b.f.lundin@gmail.com

view thread (24+ messages)  latest in thread

Message-ID: <4C6CD383-ADC0-4529-82FF-2141568C09BB@gmail.com>
Permalink:  ../4C6CD383-ADC0-4529-82FF-2141568C09BB@gmail.com/
Also on:    postgresql.org/message-id/4C6CD383-ADC0-4529-82FF-2141568C09BB@gmail.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: b.f.lundin@gmail.com, tgl@sss.pgh.pa.us, adrian.klaver@aklaver.com
  Subject: Re: Order by and timestamp
  In-Reply-To: <4C6CD383-ADC0-4529-82FF-2141568C09BB@gmail.com>
  References: <63004F55-4CA3-40F8-A898-E7A646B0EBD3@gmail.com> <c171c26b-fd5e-b4bf-ec86-97b6f8dbcbe0@aklaver.com> <24142.1584319263@sss.pgh.pa.us> <7D74B8B5-DFBD-4B5B-85C6-A516343E49C1@gmail.com> <346C3B58-D29E-4CC2-8200-691ECA91F494@gmail.com> <10f84f23-6011-28ab-79a1-a1c259424d2e@aklaver.com> <72890A04-294E-4753-8839-69F0BAD9AA17@gmail.com> <8265.1584376814@sss.pgh.pa.us> <4C6CD383-ADC0-4529-82FF-2141568C09BB@gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox