log_rotation_age integer overflow display quirk

Started by Stefan Kaltenbrunnerover 17 years ago3 messages
#1Stefan Kaltenbrunner
stefan@kaltenbrunner.cc

I just noticed that setting log_rotation_age to a value larger than 24
days results in rather weird output (I have not actually tested yet if
that affects the functionality too or just the output):

test=# show log_rotation_age;
log_rotation_age
------------------
-2134967296ms
(1 row)

this is a 64bit build of 8.3.3 on Debian/Linux.

Stefan

#2Bernd Helmle
mailings@oopsware.de
In reply to: Stefan Kaltenbrunner (#1)
Re: log_rotation_age integer overflow display quirk

--On Freitag, Juli 04, 2008 11:31:07 +0200 Stefan Kaltenbrunner
<stefan@kaltenbrunner.cc> wrote:

I just noticed that setting log_rotation_age to a value larger than 24
days results in rather weird output (I have not actually tested yet if
that affects the functionality too or just the output):

test=# show log_rotation_age;
log_rotation_age
------------------
-2134967296ms
(1 row)

This seems to be a bug in _ShowOption(), where the corresponding value is
converted into milliseconds to get the biggest possible time unit to
display. This overflows the result variable (which is declared as int),
causing this strange output.

--
Thanks

Bernd

#3Tom Lane
tgl@sss.pgh.pa.us
In reply to: Bernd Helmle (#2)
Re: log_rotation_age integer overflow display quirk

Bernd Helmle <mailings@oopsware.de> writes:

--On Freitag, Juli 04, 2008 11:31:07 +0200 Stefan Kaltenbrunner
<stefan@kaltenbrunner.cc> wrote:

I just noticed that setting log_rotation_age to a value larger than 24
days results in rather weird output (I have not actually tested yet if
that affects the functionality too or just the output):

This seems to be a bug in _ShowOption(), where the corresponding value is
converted into milliseconds to get the biggest possible time unit to
display. This overflows the result variable (which is declared as int),
causing this strange output.

Yup --- fixed by using int64 arithmetic for the units conversion.

regards, tom lane