Re: Problem reloading regression database - Mailing list pgsql-hackers

From Brent Verner
Subject Re: Problem reloading regression database
Date
Msg-id 20020115054438.GA10537@rcfile.org
Whole thread Raw
In response to Re: Problem reloading regression database  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Problem reloading regression database  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: Problem reloading regression database  (Brent Verner <brent@rcfile.org>)
List pgsql-hackers
[2002-01-14 21:52] Tom Lane said:
| Brent Verner <brent@rcfile.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, and I'm seeing no new problems (so far), but there is a problem 
in the current copy.c.  Running the following on unmodified 7.2b5 
causes the backend to consume 17-18Mb of memory.  Removing the 
REFERENCES on yyy.b causes memory use to be normal.

bash$ cat copy.sql 
DROP table yyy;
DROP SEQUENCE yyy_id_seq ;
DROP TABLE zzz;
DROP SEQUENCE zzz_id_seq ;
CREATE TABLE zzz ( id SERIAL, a INT, b TEXT NOT NULL DEFAULT 'test' PRIMARY KEY, c INT NOT NULL DEFAULT 1
);
CREATE TABLE yyy ( id SERIAL, a INT, b TEXT NOT NULL DEFAULT 'test' REFERENCES zzz(b), c INT NOT NULL DEFAULT 1
);
-- make sure there is a 'test' value in zzz.b
INSERT INTO zzz (a) VALUES (10);
COPY yyy FROM '/tmp/sometmpfilehuh'

bash$ for i in `seq 1 200000`; do echo "$i     $i      test    $i" >> /tmp/sometmpfilehuh; done

bash$ head -1 /tmp/sometmpfilehuh; tail -1 /tmp/sometmpfilehuh
1 1 test  1
200000  200000  test  200000

bash$ ./psql < copy.sql


Any ideas?  I'm looking around ExecBRInsertTriggers() to see what 
might need to be freed around that call.

thanks. 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


pgsql-hackers by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: About pg_upgrade
Next
From: Peter Eisentraut
Date:
Subject: Re: About pg_upgrade