Tomas Vondra wrote:
> So far everything seems ok, but let's create another child table
>
[...]
> ======================================================================
>
> and do the execution plan again:
>
> ======================================================================
>
> EXPLAIN EXECUTE tmp;
>
> ------------------------------------------------------------------------
> Aggregate (cost=73.50..73.51 rows=1 width=4)
> -> Append (cost=0.00..62.80 rows=4280 width=4)
> -> Seq Scan on parent (cost=0.00..31.40 rows=2140 width=4)
> -> Seq Scan on child_0 parent (cost=0.00..31.40 rows=2140 width=4)
>
> ======================================================================
>
> Ooops, the new child table is missing ;(
Yes, this is a known defect of the partitioning code, and it's one of
(probably the most powerful) reason why it's not enabled by default.
With PL/pgSQL functions you don't have to destroy and recreate the
function -- just close the connection and reconnect.
It's not fixed in 8.2. There's been a lot of noise about fixing this
for 8.3 (look for "plan invalidation"), but it's not done yet.
--
Alvaro Herrera http://www.CommandPrompt.com/
The PostgreSQL Company - Command Prompt, Inc.