From jkanter@virginia.edu Tue Apr 9 14:06:17 2002 Received: from mail.virginia.edu (mail.Virginia.EDU [128.143.2.9]) by postgresql.org (Postfix) with SMTP id B489F47603C for ; Tue, 9 Apr 2002 10:06:17 -0400 (EDT) Received: from smtp.mail.virginia.edu by mail.virginia.edu id ac29846; 9 Apr 2002 10:06 EDT Received: from jlk3xpc (d-128-19-222.bootp.Virginia.EDU [128.143.19.222]) by smtp.mail.Virginia.EDU (8.9.3/8.9.3) with SMTP id KAA30916 for ; Tue, 9 Apr 2002 10:06:19 -0400 Message-ID: <00a001c1dfd0$4818a1d0$de138f80@virginia.edu> From: Jodi Kanter To: Postgres Admin List Subject: table dump Date: Tue, 9 Apr 2002 10:10:19 -0400 MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_009D_01C1DFAE.C0DC2140" X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 5.50.4522.1200 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4522.1200 X-Archive-Number: 200204/76 X-Sequence-Number: 3964 This is a multi-part message in MIME format. ------=_NextPart_000_009D_01C1DFAE.C0DC2140 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable I just completed a data only dump of a table by using the following command: pg_dump genex -Rau -t species > species.sql I noticed that the first line of the file seems to be disabling some postgr= es trigger. It reads: UPDATE "pg_class" SET "reltriggers" =3D 0 WHERE "relname" =3D 'species'; Then all the data is listed. At the end of the file the triggers are enabled again with the following co= mmand: UPDATE pg_class SET reltriggers =3D (SELECT count(*) FROM pg_trigger where = pg_class.oid =3D tgrelid) WHERE relname =3D 'species'; Can someone explain why this is happening? The problem is that I am coping = this dump into another schema creation file that I have. I want the data fr= om this particular file included in with my new database. However, I am cre= ating this database with a user account so that all tables will be owned by= that user. I think the problem here is that this trigger stuff requires th= at you be signed in as postgres in order to do anything with the pg_class t= able. correct? Any assistane would be greatly appreciated. thanks, Jodi _______________________________ Jodi L Kanter BioInformatics Database Administrator University of Virginia (434) 924-2846 jkanter@virginia.edu =20 =20 =20 ------=_NextPart_000_009D_01C1DFAE.C0DC2140 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
I just completed a data only dump of a = table=20 by using the following command:
 
pg_dump genex -Rau -t species= >=20 species.sql
 
I noticed that the first line of the fi= le=20 seems to be disabling some postgres trigger. It reads:
 
UPDATE "pg_class" SET "reltriggers" =3D= 0 WHERE=20 "relname" =3D 'species';
 
Then all the data is listed.
 
At the end of the file the triggers are= =20 enabled again with the following command:
 
UPDATE pg_class SET reltriggers =3D (SE= LECT=20 count(*) FROM pg_trigger where pg_class.oid =3D tgrelid) WHERE relname =3D= =20 'species';
 
Can someone explain why this is happeni= ng? The=20 problem is that I am coping this dump into another schema creation file tha= t I=20 have. I want the data from this particular file included in with my new=20 database. However, I am creating this database with a user account so that = all=20 tables will be owned by that user. I think the problem here is that this tr= igger=20 stuff requires that you be signed in as postgres in order to do anything wi= th=20 the pg_class table. correct?
 
Any assistane would be greatly=20 appreciated.
thanks,
Jodi
 

 
 

_______________________________
Jodi=20 L Kanter
BioInformatics Database Administrator
University of=20 Virginia
(434) 924-2846
jkanter@virginia.edu

 

 

 

<= /DIV> ------=_NextPart_000_009D_01C1DFAE.C0DC2140-- From sszabo@megazone23.bigpanda.com Tue Apr 9 15:53:21 2002 Received: from megazone.bigpanda.com (megazone.bigpanda.com [63.150.15.178]) by postgresql.org (Postfix) with ESMTP id 83F12476147 for ; Tue, 9 Apr 2002 11:53:21 -0400 (EDT) Received: by megazone.bigpanda.com (Postfix, from userid 1001) id 6D030D5FA; Tue, 9 Apr 2002 08:53:25 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by megazone.bigpanda.com (Postfix) with ESMTP id 60BA95C01; Tue, 9 Apr 2002 08:53:25 -0700 (PDT) Date: Tue, 9 Apr 2002 08:53:25 -0700 (PDT) From: Stephan Szabo To: Jodi Kanter Cc: Postgres Admin List Subject: Re: table dump In-Reply-To: <00a001c1dfd0$4818a1d0$de138f80@virginia.edu> Message-ID: <20020409085143.Y94187-100000@megazone23.bigpanda.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Archive-Number: 200204/77 X-Sequence-Number: 3965 On Tue, 9 Apr 2002, Jodi Kanter wrote: > I just completed a data only dump of a table by using the following command: > > pg_dump genex -Rau -t species > species.sql > > I noticed that the first line of the file seems to be disabling some > postgres trigger. It reads: > > UPDATE "pg_class" SET "reltriggers" = 0 WHERE "relname" = 'species'; > > Then all the data is listed. > > At the end of the file the triggers are enabled again with the > following command: > > UPDATE pg_class SET reltriggers = (SELECT count(*) FROM pg_trigger > where pg_class.oid = tgrelid) WHERE relname = 'species'; > > Can someone explain why this is happening? The problem is that I am > coping this dump into another schema creation file that I have. I want > the data from this particular file included in with my new database. > However, I am creating this database with a user account so that all > tables will be owned by that user. I think the problem here is that > this trigger stuff requires that you be signed in as postgres in order > to do anything with the pg_class table. correct? You'd need to be a superuser I'd guess. The reason for those statmenets is to turn off foreign key constraints during the load of what's assumed to be correct data since it came from a dump. You can ignore them if you don't have any or don't mind having the constraints run. From markcarew@bigpond.com Sat Apr 13 08:10:03 2002 Received: from jupiter.hub.org (jupiter.hub.org [64.49.215.5]) by postgresql.org (Postfix) with ESMTP id 0C8674759B5 for ; Sat, 13 Apr 2002 04:10:03 -0400 (EDT) Received: from jupiter.hub.org (localhost [127.0.0.1]) by jupiter.hub.org (8.12.2/8.12.2) with ESMTP id g3D89wFs085303 for ; Sat, 13 Apr 2002 03:10:00 -0500 (CDT) (envelope-from news@jupiter.hub.org) Received: (from news@localhost) by jupiter.hub.org (8.12.2/8.12.2/Submit) id g3D7lbft072100 for pgsql-admin@postgresql.org; Sat, 13 Apr 2002 02:47:37 -0500 (CDT) From: "mark carew" X-Newsgroups: comp.databases.postgresql.admin Subject: Re: table dump Date: Sat, 13 Apr 2002 17:45:03 +1000 Organization: Hub.Org Networking Services (http://www.hub.org) Lines: 23 Message-ID: References: <00a001c1dfd0$4818a1d0$de138f80@virginia.edu> X-Complaints-To: news@hub.org X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2600.0000 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000 To: pgsql-admin@postgresql.org X-Archive-Number: 200204/122 X-Sequence-Number: 4010 Hi Jodi, Its to stop the triggers firing when you restore the new database from the dumped file. Imagine that the triggers have already done their work on other tables when the data was first inserted or later changed. With pg_dump you are taking a snap shot that you would later wish perhaps to restore. The foreign key, table and column constraints are not turned off because their enforcement is still valid at restore time. For example the data may have mysteriously been damaged in the database or in the dump file and you would thus need to know about this situation at restore time. The dumped file is thus copied back at restore time not inserted. Regards Mark Carew Brisbane Australia.