-- 0.20.0 (eighteenth review): a partitioned table, a partition and an inheritance tree are not watched. A key is -- read in one table, under its own unique index; a partitioned table's index covers its partitions only when the key is -- its partition key, and a read of an inheritance parent reads its children, which its index does not cover. Until the -- seventeenth cut a partitioned table was watched (the sixth review fixed a partition whose columns stand in another -- order); now watch() refuses it, and a read refuses a table that became one of these after watch() (truth_review18). \set VERBOSITY terse CREATE EXTENSION pg_phasevec; SELECT phasevec.reader_register($n$r1$n$, repeat($h$a$h$, 64), 4) > 0 AS r1; r1 ---- t (1 row) CREATE TABLE pn (id int PRIMARY KEY, body text, tag text) PARTITION BY RANGE (id); CREATE TABLE pn1 PARTITION OF pn FOR VALUES FROM (1) TO (100); CREATE TABLE pn2 (tag text, body text, id int NOT NULL); ALTER TABLE pn ATTACH PARTITION pn2 FOR VALUES FROM (100) TO (200); INSERT INTO pn VALUES (1, $t$one$t$, $t$a$t$), (150, $t$one-fifty$t$, $t$b$t$); SELECT phasevec.watch($w$pn$w$, $w$pn$w$::regclass, $k$id$k$, $r$r::text$r$, $n$r1$n$) > 0 AS watch; ERROR: phasevec: public.pn cannot be watched by id: it is a partitioned table SELECT phasevec.watch($w$pn1$w$, $w$pn1$w$::regclass, $k$id$k$, $r$r::text$r$, $n$r1$n$) > 0 AS watch; ERROR: phasevec: public.pn1 cannot be watched by id: it is a partition of another table SELECT phasevec.watch($w$pn2$w$, $w$pn2$w$::regclass, $k$id$k$, $r$r::text$r$, $n$r1$n$) > 0 AS watch; ERROR: phasevec: public.pn2 cannot be watched by id: it is a partition of another table -- a table that was watched and is attached as a partition afterwards: reads refuse CREATE TABLE pn3 (id int PRIMARY KEY, body text, tag text); INSERT INTO pn3 VALUES (250, $t$two-fifty$t$, $t$c$t$); SELECT phasevec.watch($w$pn3$w$, $w$pn3$w$::regclass, $k$id$k$, $r$r.body$r$, $n$r1$n$) > 0 AS watch; watch ------- t (1 row) SELECT key, body FROM phasevec._render($w$pn3$w$, NULL); key | body -----+----------- 250 | two-fifty (1 row) ALTER TABLE pn ATTACH PARTITION pn3 FOR VALUES FROM (200) TO (300); SELECT key, body FROM phasevec._render($w$pn3$w$, NULL); ERROR: phasevec: watch pn3 cannot be read: public.pn3: it is a partition of another table -- detached, it reads again ALTER TABLE pn DETACH PARTITION pn3; SELECT key, body FROM phasevec._render($w$pn3$w$, NULL); key | body -----+----------- 250 | two-fifty (1 row) DROP TABLE pn, pn3; DROP EXTENSION pg_phasevec;