heterodb / pg-strom

PG-Strom - Master development repository
http://heterodb.github.io/pg-strom/
Other
1.3k stars 162 forks source link

PG16 regression test failed: sometimes update fails if the table has scalar array type column #848

Closed 0-kaz closed 1 month ago

0-kaz commented 1 month ago

The query to reproduce:

DROP TABLE IF EXISTS regtest_data;
CREATE TABLE regtest_data (
  id    int,
  x     int[],
  y     numeric[],
  z     text[]
);
SELECT pgstrom.random_setseed(20190630);
INSERT INTO regtest_data (
  SELECT x, array[pgstrom.random_int(2,0,1000),
                  pgstrom.random_int(2,0,1000),
                  pgstrom.random_int(2,0,1000)],
            array[pgstrom.random_float(2,0.0,100.0)::numeric(9,2),
                  pgstrom.random_float(2,0.0,100.0)::numeric(9,2),
                  pgstrom.random_float(2,0.0,100.0)::numeric(9,2)],
            array[pgstrom.random_text(2,'k***'),
                  pgstrom.random_text(2,'k***'),
                  pgstrom.random_text(2,'k***')]
    FROM generate_series(1,5000) x
);
UPDATE regtest_data
   SET x = array_append(x, pgstrom.random_int(2,0,1000)::int),
       y = array_append(y, pgstrom.random_float(2,0.0,100.0)::numeric(9,2)),
       z = array_append(z, pgstrom.random_text(2,'k***'))
 WHERE id % 7 = 3;
# same query above
UPDATE regtest_data
   SET x = array_append(x, pgstrom.random_int(2,0,1000)::int),
       y = array_append(y, pgstrom.random_float(2,0.0,100.0)::numeric(9,2)),
       z = array_append(z, pgstrom.random_text(2,'k***'))
 WHERE id % 7 = 3;

Error message

ERROR:  unexpected Var-node in fallback expression: {VAR :varno 1 :varattno -1 :vartype 27 :vartypmod -1 :varcollid 0 :varnullingrels (b) :varlevelsup 0 :varnosyn 1 :varattnosyn -1 :location -1}

This can prevent by adding VACUUM

postgres=# UPDATE regtest_data
postgres-#    SET x = array_append(x, pgstrom.random_int(2,0,1000)::int),
postgres-#        y = array_append(y, pgstrom.random_float(2,0.0,100.0)::numeric(9,2)),
postgres-#        z = array_append(z, pgstrom.random_text(2,'k***'))
postgres-#  WHERE id % 7 = 3;
UPDATE 714
postgres=# VACUUM;
VACUUM
postgres=# UPDATE regtest_data
postgres-#    SET x = array_append(x, pgstrom.random_int(2,0,1000)::int),
postgres-#        y = array_append(y, pgstrom.random_float(2,0.0,100.0)::numeric(9,2)),
postgres-#        z = array_append(z, pgstrom.random_text(2,'k***'))
postgres-#  WHERE id % 7 = 3;
UPDATE 714
0-kaz commented 1 month ago

This doesn't occured at 4cf5ef825eb05883c22071735d6ccdd9ba76eedc Close.