pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pgsql: Fix unportable code in pgbench.
4+ messages / 2 participants
[nested] [flat]

* pgsql: Fix unportable code in pgbench.
@ 2019-04-17 21:30  Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 1 reply; 4+ messages in thread

From: Tom Lane @ 2019-04-17 21:30 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix unportable code in pgbench.

The buildfarm points out that UINT64_FORMAT might not work with sscanf;
it's calibrated for our printf implementation, which might not agree
with the platform-supplied sscanf.  Fall back to just accepting an
unsigned long, which is already more than the documentation promises.

Oversight in e6c3ba7fb; back-patch to v11, as that was.

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/1a75c1d0c5d967ea2adcd7129092687cded4e7bf

Modified Files
--------------
src/bin/pgbench/pgbench.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)



^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* pgsql: Fix unportable code in pgbench.
@ 2019-04-17 21:30  Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 4+ messages in thread

From: Tom Lane @ 2019-04-17 21:30 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix unportable code in pgbench.

The buildfarm points out that UINT64_FORMAT might not work with sscanf;
it's calibrated for our printf implementation, which might not agree
with the platform-supplied sscanf.  Fall back to just accepting an
unsigned long, which is already more than the documentation promises.

Oversight in e6c3ba7fb; back-patch to v11, as that was.

Branch
------
REL_11_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/7e5569fdee0c2173de564a1b0649cb4d4cc5b890

Modified Files
--------------
src/bin/pgbench/pgbench.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)



^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: pgsql: Fix unportable code in pgbench.
@ 2019-04-17 21:46  Fabien COELHO <coelho@cri.ensmp.fr>
  parent: Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 1 reply; 4+ messages in thread

From: Fabien COELHO @ 2019-04-17 21:46 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: PostgreSQL Developers <pgsql-hackers@lists.postgresql.org>


Hello Tom,

> Fix unportable code in pgbench.

Sorry for this unforseen issue... portability is a pain:-(

> The buildfarm points out that UINT64_FORMAT might not work with sscanf;
> it's calibrated for our printf implementation, which might not agree
> with the platform-supplied sscanf.  Fall back to just accepting an
> unsigned long, which is already more than the documentation promises.

Yep, but ISTM that it is down to 32 bits, whereas the PRNG seed expects 48 
bits a few lines below:

     base_random_sequence.xseed[0] = iseed & 0xFFFF;
     base_random_sequence.xseed[1] = (iseed >> 16) & 0xFFFF;
     base_random_sequence.xseed[2] = (iseed >> 32) & 0xFFFF;

So the third short is now always 0. Hmmm. I'll propose another option over 
the week-end.

-- 
Fabien.





^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: pgsql: Fix unportable code in pgbench.
@ 2019-04-17 21:57  Tom Lane <tgl@sss.pgh.pa.us>
  parent: Fabien COELHO <coelho@cri.ensmp.fr>
  0 siblings, 0 replies; 4+ messages in thread

From: Tom Lane @ 2019-04-17 21:57 UTC (permalink / raw)
  To: Fabien COELHO <coelho@cri.ensmp.fr>; +Cc: PostgreSQL Developers <pgsql-hackers@lists.postgresql.org>

Fabien COELHO <coelho@cri.ensmp.fr> writes:
>> Fix unportable code in pgbench.

> Sorry for this unforseen issue... portability is a pain:-(

I think it's my fault, actually --- I don't remember how much of
that patch was yours.

> Yep, but ISTM that it is down to 32 bits,

Only on 32-bit-long machines, which are a dwindling minority (except
for Windows, which I don't really care about).

> So the third short is now always 0. Hmmm. I'll propose another option over 
> the week-end.

I suppose we could put pg_strtouint64 somewhere where pgbench can use it,
but TBH I don't think it's worth the trouble.  The set of people using
the --random-seed=int option at all is darn near empty, I suspect,
and the documentation only says you can write an int there.

			regards, tom lane





^ permalink  raw  reply  [nested|flat] 4+ messages in thread


end of thread, other threads:[~2019-04-17 21:57 UTC | newest]

Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2019-04-17 21:30 pgsql: Fix unportable code in pgbench. Tom Lane <tgl@sss.pgh.pa.us>
2019-04-17 21:46 ` Fabien COELHO <coelho@cri.ensmp.fr>
2019-04-17 21:57   ` Tom Lane <tgl@sss.pgh.pa.us>
2019-04-17 21:30 pgsql: Fix unportable code in pgbench. Tom Lane <tgl@sss.pgh.pa.us>

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