pg_bulkload
pg_bulkload copied to clipboard
WARNING: TupleDesc reference leak
It seems we have a problem.
A failure during trying to load into a composite type field (a record value) causes TupleDesc leak (I see that leaking TupleDesc is for the record's type)
$ psql
create type foot as (a int, b char);
create table foo (a foot);
$ cat /tmp/foo.csv
"(1,i)"
"(i,1)"
$ pg_bulkload -O foo -i /tmp/foo.csv
NOTICE: BULK LOAD START
WARNING: TupleDesc reference leak: TupleDesc 0x7fc3f8304ea8 (28062,-1) still referenced
NOTICE: BULK LOAD END
0 Rows skipped.
1 Rows successfully loaded.
1 Rows not loaded due to parse errors.
0 Rows not loaded due to duplicate errors.
0 Rows replaced with new rows.
WARNING: some rows were not loaded due to errors.
The error occurs for the second record:
Parse error Record 1: Input Record 2: Rejected - column 1. invalid input syntax for integer: "i"
We should have some way of preventing that leak: Maybe, PG_CATCH() block in ReaderNext() is a place to fix such an issue. Not yet sure how. The error occurs deep within PostgreSQL guts (in this case, when integer type input function is called to parse the line's field to populate a column).