BUG #15460: Error while creating index or constraint

The Post Office <noreply@postgresql.org>

From: PG Bug reporting form <noreply@postgresql.org>
To: pgsql-bugs@lists.postgresql.org
Cc: paul.vanderlinden@mapcreator.eu
Date: 2018-10-26T09:31:18Z
Lists: pgsql-bugs
The following bug has been logged on the website:

Bug reference:      15460
Logged by:          doskabouter
Email address:      paul.vanderlinden@mapcreator.eu
PostgreSQL version: 11.0
Operating system:   Windows Server 2008 R2
Description:        

On large tables I get an error on:

CREATE INDEX nx_tablename ON tablename USING btree (col1); col1 being an
integer
and
ALTER TABLE ONLY tablename ADD CONSTRAINT pk_tablename PRIMARY KEY (col1,
col2); col1 and col2 both integer

First noticed that with pg_restore (from a pg_dump from PG10)
pg_restore: [archiver (db)] Error while PROCESSING TOC:
pg_restore: [archiver (db)] Error from TOC entry 14005; 1259 546886907 INDEX
nx_tablename postgres
pg_restore: [archiver (db)] could not execute query: ERROR:  could not
determine
 size of temporary file "0"
    Command was: CREATE INDEX nx_tablename ON tablename USING btree
(col1);

After the restore finished (with that error) I tried running that same query
in pgadmin.
There I got:
********** Error **********
ERROR: could not determine size of temporary file "0"
SQL state: 58P01

table definition:

CREATE TABLE tablename
(
  col1 bigint NOT NULL,
  col2 bigint NOT NULL,
  col3 bigint NOT NULL,
  col4 bigint NOT NULL,
  col5 bigint,
  col6 integer NOT NULL,
)

I have several comparable tables (same columns). Errors occur for tables
with 386726424 or 556071229 records
for other smaller tables (largest has 163183465 records) there's no error

postgres/postgis versions:
"POSTGIS="2.5.0 r16836" [EXTENSION] PGSQL="110" GEOS="3.7.0-CAPI-1.11.0
3.7.0" PROJ="Rel. 4.9.3, 15 August 2016" GDAL="GDAL 2.2.4, released
2018/03/19" LIBXML="2.7.8" LIBJSON="0.12" LIBPROTOBUF="1.2.1" RASTER"
"PostgreSQL 11.0, compiled by Visual C++ build 1914, 64-bit"
running on a 28-core, 75GB Windows server 2008 R2 64-bit machine

postgres.conf: All parallel related options are at default

Commits

  1. Have BufFileSize() ereport() on FileSize() failure.

  2. Use 64 bit type for BufFileSize().

  3. Adjust trace_sort log messages.

  4. Fix some sloppiness in the new BufFileSize() and BufFileAppend() functions.