Re: Problem reloading regression database

From: Brent Verner <brent(at)rcfile(dot)org>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Problem reloading regression database
Date: 2002-01-15 07:02:13
Message-ID: 20020115070213.GA10791@rcfile.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

[2002-01-14 21:52] Tom Lane said:
| Brent Verner <brent(at)rcfile(dot)org> writes:
| > gotcha. No, I don't think anything inside that loop expects to
| > persist across iterations. The attribute_buf is static to the
| > file, and initialized in DoCopy.
|
| There is more to attribute_buf than meets the eye ;-)
|
| > What I ended up doing is switching to per-tuple-context prior to
| > the input loop, then switching back to the (saved) query-context
| > after exiting the loop. I followed ResetTupleExprContext back, and
| > it doesn't seem to do anything that would require a switch per loop.
| > Are there any problems this might cause that I'm not seeing with
| > my test case?
|
| I really don't feel comfortable with running heap_insert or the
| subsequent operations in a per-tuple context. Have you tried any
| test cases that involve triggers or indexes?

Yes. The attached patch appears to do the right thing with all
indexes and triggers (RI) that I've tested. I'm still doing the
MemoryContextSwitchTo() outside the main loop, and have added some
more sanity checking for column name input.

If anyone could test this (with non-critical data ;-) or otherwise
give feedback, I'd appreciate it; especially if someone could test
with a BEFORE INSERT trigger.

cheers.
brent

--
"Develop your talent, man, and leave the world something. Records are
really gifts from people. To think that an artist would love you enough
to share his music with anyone is a beautiful thing." -- Duane Allman

Attachment Content-Type Size
copy.colspec.3.diff.gz application/x-gunzip 5.1 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Gavin Sherry 2002-01-15 09:13:08 FATAL 1: Relation 'pg_shadow' does not exist
Previous Message Barry Lind 2002-01-15 06:55:12 Re: Failure in timestamptz of JDBC of 7.2b4