Reputation: 457
Using the the example Postgres Partitioning Docs 9.3 should the master table "measurement" get rows inserted when performing inserts after creating the trigger functions and the trigger?
Using the example given in the docs upon performing a insert both the master and the child table have rows inserted. I though that using < RETURN NULL > in the trigger function would prohibit the master table from having rows inserted.
Upvotes: 4
Views: 691
Reputation: 324541
The rows are not inserted in the parent table. They are just visible from the parent table because the child table(s) extend it.
Use SELECT * FROM ONLY measurement;
and you will see that those rows aren't actually in measurement
, only the child table. ONLY
says "use only this table, not its children, in this query".
Examine the output of explain select * from measurement
to see what's going on when you leave out the ONLY
. It's basically like a UNION ALL
over the parent and its children done internally.
Upvotes: 5