VACUUM FULL results in ERROR: integer out of range

From: Manuel Rigger <rigger(dot)manuel(at)gmail(dot)com>
To: PostgreSQL mailing lists <pgsql-bugs(at)lists(dot)postgresql(dot)org>
Subject: VACUUM FULL results in ERROR: integer out of range
Date: 2019-07-07 16:30:58
Message-ID: CA+u7OA7VT2YvyRz1FWXtr+p9ayUxGEqB8xJOsJT+sywXVKVvGw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Hi everyone,

Consider the example below:

-- thread 1:
\c db1;
CREATE TABLE t1(c0 int);
INSERT INTO t1(c0) VALUES(2147483647);
UPDATE t1 SET c0 = 0;
CREATE INDEX i0 ON t1((1 + t1.c0));
VACUUM FULL; -- unexpected: ERROR: integer out of range

-- thread 2:
DROP DATABASE db2;
CREATE DATABASE db2;

I would expect that the VACUUM FULL executes without error. However,
it shows an error "integer out of range", which would be expected for
the CREATE INDEX, had the UPDATE not been executed. I can reliably
reproduce this on my machine on the first execution of thread 1's
statements when having a second thread that (repeatedly) drops and
creates a database. I've attached a Java program that should make it
possible to reproduce this by throwing an exception
"org.postgresql.util.PSQLException: ERROR: integer out of range"
immediately after starting the program.

This bug report is similar to a previous case that I reported, where
executing VACUUM FULL on distinct databases can result in a deadlock
(see https://www.postgresql.org/message-id/CA%2Bu7OA6pL%2B7Xm_NXHLenxffe3tCr3gTamVdr7zPjcWqW0RFM-A%40mail.gmail.com)
which might also be unexpected from a user perspective, so I am not
sure if this case bug report is considered relevant.

Best,
Manuel

Attachment Content-Type Size
ExecutePostgresIntegerOverflow.java text/x-java 1.8 KB

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2019-07-07 17:18:44 Re: VACUUM FULL results in ERROR: integer out of range
Previous Message Bruce Momjian 2019-07-06 20:31:14 Re: ODBC: SQLGetDescField returns incorrect length for SQL_DESC_COUNT field of APD