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

Reply via email to