Re: xlogdump fixups and WAL log question. - Mailing list pgsql-hackers

From Alvaro Herrera
Subject Re: xlogdump fixups and WAL log question.
Date
Msg-id 20061022155919.GA2138@alvh.no-ip.org
Whole thread Raw
In response to Re: xlogdump fixups and WAL log question.  ("Simon Riggs" <simon@2ndquadrant.com>)
Responses Re: xlogdump fixups and WAL log question.
List pgsql-hackers
Simon Riggs wrote:
> On Sat, 2006-10-21 at 19:24 -0400, Tom Lane wrote:

> > Can you make the patch cover the case of
> > 
> >     begin;
> >     truncate foo;
> >     copy foo from ...
> >     commit;
> > 
> > It might be infeasible to detect this case, but if it's not ...
> 
> I think it is possible to detect this case without making catalog
> entries, so I'll give this a try. Methinks that the truncate *must* be
> the immediately preceding command, otherwise we might have a trigger
> executing to put rows back into the table before we COPY.

Hmm, is it possible to save the "is empty" info somewhere in local
memory, perhaps the relcache (not necessarily propagated), and have
heap_insert turn it off?

That would help when you do things like

begin;
truncate foo, bar;
copy foo from ...
copy bar from ...
commit;

On the other hand, what happens if you do

begin;
truncate foo;
-- another sessioncopy foo from ...

-- original session
copy foo from ...
commit;


How do you detect that the table is no longer empty?

-- 
Alvaro Herrera                                http://www.CommandPrompt.com/
PostgreSQL Replication, Consulting, Custom Development, 24x7 support


pgsql-hackers by date:

Previous
From: "Simon Riggs"
Date:
Subject: Re: adminpack and pg_catalog
Next
From: Tom Lane
Date:
Subject: Re: xlogdump fixups and WAL log question.