Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.92) (envelope-from ) id 1jDxIE-0007GM-Tm for pgsql-general@arkaria.postgresql.org; Mon, 16 Mar 2020 21:29:03 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1jDxID-0005bB-Ll for pgsql-general@arkaria.postgresql.org; Mon, 16 Mar 2020 21:29:01 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1jDxID-0005b3-7z for pgsql-general@lists.postgresql.org; Mon, 16 Mar 2020 21:29:01 +0000 Received: from mail-lj1-x242.google.com ([2a00:1450:4864:20::242]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1jDxIA-0007Z7-C5 for pgsql-general@postgresql.org; Mon, 16 Mar 2020 21:29:00 +0000 Received: by mail-lj1-x242.google.com with SMTP id e18so20442334ljn.12 for ; Mon, 16 Mar 2020 14:28:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:message-id:mime-version:subject:date:in-reply-to:cc:to :references; bh=/PdioZPpBTHQzC+KOWPTNbFSjyQDkQUsePxLOq9PacM=; b=Ho1CXLd9shiDIdtVcHk3MFnhVzJ4XuQicNex2y7JDQbuF9mdxmUAWnxgiXWfijxnpw a3c7kt8YkRygTZqtTBN5CYpLNna3CMvrHDBPVk/KHuXVwZfANl22dV5HcpHY+RbftCsE CojnoFaubvtigbCsRfXdF0I+laj0mhfgHDMgL8g+V+sAxXoTDdLH+YPz5H4JWBWFPa/b KKrnyCGi72YkN6O0ff+QmEBayh85AF1jIeIQJixcfneE13UwUrGKe8WdL5ldBP+WRerK oQMGgxgu3V6toA9rySQzaNUIwZWLxgBRlVevVJ584qtUI8cXNWEkm/nHdtNUnaXp63sg /26Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:message-id:mime-version:subject:date :in-reply-to:cc:to:references; bh=/PdioZPpBTHQzC+KOWPTNbFSjyQDkQUsePxLOq9PacM=; b=EgckkFTpZ18zRa+/H/xphm7p5eHzqZauJ+yYJ5a6iGAJtN7Xm8SLv13AQ7kXTgtxDg z/RmTAWLlrOPOJLe8mWVS9fkyK5DfzSyrCUII7vWoL6OfyBi00XHs31yZJmN8zkQ5Dr4 hU18MPutt1hyEmM4klJuID9NOhKoOly3dJ1n6nvh4A+qc5egk5IJgEFaO7gN5RPaXp3M tZuicCUGabJOd31BPi/qYYreW7Z8U+l3ex1IsTNv6H3mKoP0dF/FM8O05aRdhqHlzMIs 4jba2nfOdE2Jit8JwBzYK3G+CjnkwFJL14DFAM5auGEjM3yiKA0cRHSIS6udMdbfm1qP ZR7g== X-Gm-Message-State: ANhLgQ0AJyGIUSrJyajQP8/ClQQP2DkvkShaFq1nA2mnnZb8KyBfTVZw 3a7pR6s3aHKFTSMbU+eKbZ9Yjwo3TtKCTw== X-Google-Smtp-Source: ADFU+vuk7HlkoA5mTNzo9nEYg8vQgtKkFAaY9ZKt9cQcpxZBOMBn+rHIfpfSiY7GQYtHua3DbI9DUQ== X-Received: by 2002:a2e:6c03:: with SMTP id h3mr832125ljc.8.1584394137175; Mon, 16 Mar 2020 14:28:57 -0700 (PDT) Received: from imac.lan (81-227-64-79-no276.tbcn.telia.com. [81.227.64.79]) by smtp.gmail.com with ESMTPSA id o25sm813299lfi.2.2020.03.16.14.28.55 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 16 Mar 2020 14:28:55 -0700 (PDT) From: =?utf-8?Q?Bj=C3=B6rn_Lundin?= Message-Id: <4C6CD383-ADC0-4529-82FF-2141568C09BB@gmail.com> Content-Type: multipart/alternative; boundary="Apple-Mail=_783C97EB-55E2-44CA-883A-66AD118ADFF8" Mime-Version: 1.0 (Mac OS X Mail 11.5 \(3445.9.1\)) Subject: Re: Order by and timestamp Date: Mon, 16 Mar 2020 22:28:54 +0100 In-Reply-To: <8265.1584376814@sss.pgh.pa.us> Cc: Adrian Klaver , pgsql-general@postgresql.org To: Tom Lane References: <63004F55-4CA3-40F8-A898-E7A646B0EBD3@gmail.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> X-Mailer: Apple Mail (2.3445.9.1) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --Apple-Mail=_783C97EB-55E2-44CA-883A-66AD118ADFF8 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 > 16 mars 2020 kl. 17:40 skrev Tom Lane : >=20 > =3D?utf-8?Q?Bj=3DC3=3DB6rn_Lundin?=3D 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)=20 >=20 >> The schema is identical to the one with trouble - which is a history = database >> Intended for testing >=20 > 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. >=20 > regards, tom lane But most of the output is correct. Like 95+%=20 I found the bad ones by chance The pi - keeping only data for 1 day then table exported and truncated = every night=20 (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=3Den_GB.UTF-8 LANGUAGE=3D LC_CTYPE=3D"en_GB.UTF-8" LC_NUMERIC=3D"en_GB.UTF-8" LC_TIME=3D"en_GB.UTF-8" LC_COLLATE=3D"en_GB.UTF-8" LC_MONETARY=3D"en_GB.UTF-8" LC_MESSAGES=3D"en_GB.UTF-8" LC_PAPER=3D"en_GB.UTF-8" LC_NAME=3D"en_GB.UTF-8" LC_ADDRESS=3D"en_GB.UTF-8" LC_TELEPHONE=3D"en_GB.UTF-8" LC_MEASUREMENT=3D"en_GB.UTF-8" LC_IDENTIFICATION=3D"en_GB.UTF-8" LC_ALL=3D bnl@pibetbot:~ $ psql Timing is on. AUTOCOMMIT off psql (9.6.10) Type "help" for help. bnl=3D# show datestyle; DateStyle=20 ----------- ISO, DMY The faulty machine=20 Ibm2 - linux debian pg-9.4 bnl@ibm2:~$ locale LANG=3Dsv_SE.UTF-8 LANGUAGE=3D LC_CTYPE=3D"sv_SE.UTF-8" LC_NUMERIC=3D"sv_SE.UTF-8" LC_TIME=3D"sv_SE.UTF-8" LC_COLLATE=3D"sv_SE.UTF-8" LC_MONETARY=3D"sv_SE.UTF-8" LC_MESSAGES=3D"sv_SE.UTF-8" LC_PAPER=3D"sv_SE.UTF-8" LC_NAME=3D"sv_SE.UTF-8" LC_ADDRESS=3D"sv_SE.UTF-8" LC_TELEPHONE=3D"sv_SE.UTF-8" LC_MEASUREMENT=3D"sv_SE.UTF-8" LC_IDENTIFICATION=3D"sv_SE.UTF-8" LC_ALL=3D bnl@ibm2:~$ psql Tidtagning =C3=A4r p=C3=A5. AUTOCOMMIT off psql (9.6.15, server 9.4.15) Skriv "help" f=C3=B6r hj=C3=A4lp. bnl=3D> show datestyle; DateStyle=20 ----------- ISO, YMD The machine briefly mentioned with basically same dataset as faulty = machine Linux Ubuntu with pg-10.6=20 bnl@tp:~$ locale LANG=3Dsv_SE.UTF-8 LANGUAGE=3D LC_CTYPE=3D"sv_SE.UTF-8" LC_NUMERIC=3D"sv_SE.UTF-8" LC_TIME=3D"sv_SE.UTF-8" LC_COLLATE=3D"sv_SE.UTF-8" LC_MONETARY=3D"sv_SE.UTF-8" LC_MESSAGES=3D"sv_SE.UTF-8" LC_PAPER=3D"sv_SE.UTF-8" LC_NAME=3D"sv_SE.UTF-8" LC_ADDRESS=3D"sv_SE.UTF-8" LC_TELEPHONE=3D"sv_SE.UTF-8" LC_MEASUREMENT=3D"sv_SE.UTF-8" LC_IDENTIFICATION=3D"sv_SE.UTF-8" LC_ALL=3D bnl@tp:~$ psql Timing is on. AUTOCOMMIT off psql (10.6 (Ubuntu 10.6-0ubuntu0.18.04.1)) Type "help" for help. bnl=3D# show datestyle; DateStyle=20 ----------- 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=3D# select version(); version = =20 = --------------------------------------------------------------------------= -------------------------------------------- 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=C3=B6rn Lundin b.f.lundin@gmail.com --Apple-Mail=_783C97EB-55E2-44CA-883A-66AD118ADFF8 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=utf-8

16 mars 2020 kl. 17:40 skrev Tom Lane <tgl@sss.pgh.pa.us>:

=3D?utf-8?Q?Bj=3DC3=3DB6rn_Lundin?=3D <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=3Den_GB.UTF-8
LANGUAGE=3D
LC_CTYPE=3D"en_GB.UTF-8"
LC_NUMERIC=3D"en_GB.UTF-8"
LC_TIME=3D"en_GB.UTF-8"
LC_COLLATE=3D"en_GB.UTF-8"
LC_MONETARY=3D"en_GB.UTF-8"
LC_MESSAGES=3D"en_GB.UTF-8"
LC_PAPER=3D"en_GB.UTF-8"
LC_NAME=3D"en_GB.UTF-8"
LC_ADDRESS=3D"en_GB.UTF-8"
LC_TELEPHONE=3D"en_GB.UTF-8"
LC_MEASUREMENT=3D"en_GB.UTF-8"
LC_IDENTIFICATION=3D"en_GB.UTF-8"
LC_ALL=3D

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

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



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

bnl@ibm2:~$ psql
Tidtagning =C3=A4r p=C3=A5.
AUTOCOMMIT off
psql (9.6.15, server = 9.4.15)
Skriv = "help" f=C3=B6r hj=C3=A4lp.

bnl=3D>= ; 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=3Dsv_SE.UTF-8
LANGUAGE=3D
LC_CTYPE=3D"sv_SE.UTF-8"
LC_NUMERIC=3D"sv_SE.UTF-8"
LC_TIME=3D"sv_SE.UTF-8"
LC_COLLATE=3D"sv_SE.UTF-8"
LC_MONETARY=3D"sv_SE.UTF-8"
LC_MESSAGES=3D"sv_SE.UTF-8"
LC_PAPER=3D"sv_SE.UTF-8"
LC_NAME=3D"sv_SE.UTF-8"
LC_ADDRESS=3D"sv_SE.UTF-8"
LC_TELEPHONE=3D"sv_SE.UTF-8"
LC_MEASUREMENT=3D"sv_SE.UTF-8"
LC_IDENTIFICATION=3D"sv_SE.UTF-8"
LC_ALL=3D

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

bnl=3D# = 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=3D# 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=C3=B6rn Lundin




= --Apple-Mail=_783C97EB-55E2-44CA-883A-66AD118ADFF8--