pgbench and timestamps

From: Jaime Soler <jaime(dot)soler(at)gmail(dot)com>
To: PostgreSQL mailing lists <pgsql-general(at)postgresql(dot)org>
Subject: pgbench and timestamps
Date: 2020-06-24 08:41:17
Message-ID: CAKVUGgQaZVAUi1Ex41H4wrru=FU+MfwgjG0aM1br6st7sz31Vw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi, does anybody know what is wrong with pgbench in this case ?. Here is a
simple query to generate a random date in a interval time.sql:

(select timestamp '2005-09-01' + random() * ( timestamp '2006-03-01
00:00:00' - timestamp '2005-09-01 00:00:00' ));

query executed successfullly with psql

/usr/lib/postgresql/12/bin/psql -p 5432 -h localhost -d picp -U
postgres -f time.sql
BEGIN
?column?
--------------------------
2005-11-24 13:22:02.4781
(1 fila)COMMIT

psql (PostgreSQL) 12.3 (Ubuntu 12.3-1.pgdg20.04+1)

but look at what happen with pgbench

pgbench -c 2 -j 2 -M prepared --file time.sql -h localhost -d picp -U
postgres -p 5432
pghost: localhost pgport: 5432 nclients: 2 nxacts: 10 dbName: picp
starting vacuum...ERROR: no existe la relación «pgbench_branches»
(ignoring this error and continuing anyway)
ERROR: no existe la relación «pgbench_tellers»
(ignoring this error and continuing anyway)
ERROR: no existe la relación «pgbench_history»
(ignoring this error and continuing anyway)
end.
client 0 executing script "time.sql"
ERROR: la sintaxis de entrada no es válida para tipo timestamp:
«2006-03-01 00$1$2»
LINE 1: ...t timestamp '2005-09-01' + random() * ( timestamp '2006-03-0...
^
client 0 sending P0_0
client 0 receiving
client 0 receiving
client 0 sending P0_1
client 0 receiving
client 0 receiving
client 0 script 0 aborted in command 1 query 0: ERROR: no existe la
sentencia preparada «P0_1»
client 1 executing script "time.sql"
ERROR: la sintaxis de entrada no es válida para tipo timestamp:
«2006-03-01 00$1$2»
LINE 1: ...t timestamp '2005-09-01' + random() * ( timestamp '2006-03-0...
^Run was
aborted; the above results are incomplete.

pgbench (PostgreSQL) 12.3 (Ubuntu 12.3-1.pgdg20.04+1)

I don't know why pgbench use timestamp: «2006-03-01 00$1$2» instead of
timestamp '2006-03-01 00:00:00'

Regards

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Peter J. Holzer 2020-06-24 09:54:48 Re: n_distinct off by a factor of 1000
Previous Message RAJAMOHAN 2020-06-24 08:31:16 ERROR: canceling statement due to conflict with recovery