CREATE STATISTICS + Table Inheritance = ERROR: tuple already updated by self

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

CREATE STATISTICS + Table Inheritance = ERROR: tuple already updated by self

David Marcin
When trying to use CREATE STATISTICS on a table with child tables, the table can no longer be analyzed -- it exits with "ERROR:  tuple already updated by self". I don't see any indication on https://www.postgresql.org/docs/11/sql-createstatistics.html that it should not work with table inheritance.

Steps to reproduce:
test=> CREATE TABLE test1 (id uuid PRIMARY KEY, dependent_id uuid);
CREATE TABLE
test=> INSERT INTO test1 (id, dependent_id) VALUES (uuid_generate_v4(), uuid_generate_v4()), (uuid_generate_v4(), uuid_generate_v4());
INSERT 0 2
test=> CREATE STATISTICS test1_stats ON id, dependent_id FROM test1;
CREATE STATISTICS
test=> ANALYZE test1;
ANALYZE
test=> CREATE TABLE test1_child () INHERITS (test1);
CREATE TABLE
test=> ANALYZE test1;
ERROR:  tuple already updated by self

Dropping the child table fixes the issue:
test=> DROP TABLE test1_child;
DROP TABLE
test=> ANALYZE test1;
ANALYZE

Reply | Threaded
Open this post in threaded view
|

Re: CREATE STATISTICS + Table Inheritance = ERROR: tuple already updated by self

Daniel Gustafsson
> On 20 Jun 2019, at 03:07, David Marcin <[hidden email]> wrote:
>
> When trying to use CREATE STATISTICS on a table with child tables, the table can no longer be analyzed -- it exits with "ERROR:  tuple already updated by self". I don't see any indication on https://www.postgresql.org/docs/11/sql-createstatistics.html that it should not work with table inheritance.

Thanks for reporting!  This is probably the same issue which is being discussed
in this thread on pgsql-hackers:

https://www.postgresql.org/message-id/flat/20190618231233.GA27470%40telsasoft.com

cheers ./daniel