Skip site navigation (1) Skip section navigation (2)

Re: Cannot recreate DB scheme using pg_dump

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: prakashn(at)uci(dot)edu
Cc: pgsql-bugs(at)postgresql(dot)org, nishad(at)ptolemy(dot)tlg(dot)uci(dot)edu
Subject: Re: Cannot recreate DB scheme using pg_dump
Date: 2004-07-19 21:06:26
Message-ID: 29645.1090271186@sss.pgh.pa.us (view raw or flat)
Thread:
Lists: pgsql-bugs
prakashn(at)uci(dot)edu writes:
> I've attached the schema dump, and the corresponding psql output when 
> run by the superuser as "psql -f schema_dump db_name >& psql_output".  

Okay, I see the problem: pg_dump is losing track of which session
authorization it's currently got selected.  This is a consequence of
what the ACL-dumping code has to do to replicate GRANTs granted by
non-owners.  The attached patch (against 7.4 branch) seems to fix it.

			regards, tom lane

Index: pg_backup_archiver.c
===================================================================
RCS file: /cvsroot/pgsql-server/src/bin/pg_dump/pg_backup_archiver.c,v
retrieving revision 1.79.2.2
diff -c -r1.79.2.2 pg_backup_archiver.c
*** pg_backup_archiver.c	24 Feb 2004 03:35:43 -0000	1.79.2.2
--- pg_backup_archiver.c	19 Jul 2004 20:56:06 -0000
***************
*** 2262,2267 ****
--- 2262,2278 ----
  			ahprintf(AH, "%s\n\n", te->defn);
  	}
  
+ 	/*
+ 	 * If it's an ACL entry, it might contain SET SESSION AUTHORIZATION
+ 	 * commands, so we can no longer assume we know the current auth setting.
+ 	 */
+ 	if (strncmp(te->desc, "ACL", 3) == 0)
+ 	{
+ 		if (AH->currUser)
+ 			free(AH->currUser);
+ 		AH->currUser = NULL;
+ 	}
+ 
  	return 1;
  }
  

In response to

pgsql-bugs by date

Next:From: PostgreSQL Bugs ListDate: 2004-07-20 14:52:51
Subject: BUG #1197: index bug
Previous:From: prakashnDate: 2004-07-19 20:41:31
Subject: Re: Cannot recreate DB scheme using pg_dump

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group