pg.ddx.io pgsql-admin@postgresql.org mailing list archive
help / color / mirror / Atom feedpg_dump --create --schema-only, how to suppress template1 functions ?
2+ messages / 2 participants
[nested] [flat]
* pg_dump --create --schema-only, how to suppress template1 functions ?
@ 2007-12-17 18:50 Scott Abel <sabel@yahoo.com>
0 siblings, 1 reply; 2+ messages in thread
From: Scott Abel @ 2007-12-17 18:50 UTC (permalink / raw)
To: pgsql-admin
I was using pg_dump --create --schema-only (or so I thought) to
maintain source files for my database that I could check into my
revision control system. Now I just tried to recreate the source file
from an updated version of the DB, and I'm finding that it dumps all
the built-in stuff from template1 (not stuff I added, AFAIK).
The last file I checked in used template1 in the "CREATE DATABASE"
statement and only had CREATE statements for functions and tables that
I created in my database. All the stuff from template1 was then
created implicitly by the template1 clause in the CREATE DATABASE
statement. This is exactly the behavior I want.
Here's the exact command line I used for 8.2.4 pg_dump in both cases
(unless I'm mistaken and somehow I ran a different version of my
script before):
pg_dump -U postgres -H myhost --create --schema-only --encoding=UTF8
--file=myoutputfile mydbname
Now when I try to run it (still with 8.2.4), the CREATE DATABASE
statement generated uses template0 and then pg_dump regurgitates every
function in my database, including those that came from template1. I
don't use most of the functions and don't want them generated in the
schema file; I really would like to figure out how to get back the old
behavior of pg_dump generating a CREATE DATABASE statement that uses
template1 as the template and only generates DDL for my tables and
functions. How do I do this?
^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: pg_dump --create --schema-only, how to suppress template1 functions ?
@ 2007-12-17 22:07 Tom Lane <tgl@sss.pgh.pa.us>
parent: Scott Abel <sabel@yahoo.com>
0 siblings, 0 replies; 2+ messages in thread
From: Tom Lane @ 2007-12-17 22:07 UTC (permalink / raw)
To: Scott Abel <sabel@yahoo.com>; +Cc: pgsql-admin
"Scott Abel" <sabel@yahoo.com> writes:
> Now when I try to run it (still with 8.2.4), the CREATE DATABASE
> statement generated uses template0 and then pg_dump regurgitates every
> function in my database, including those that came from template1. I
> don't use most of the functions and don't want them generated in the
> schema file; I really would like to figure out how to get back the old
> behavior of pg_dump generating a CREATE DATABASE statement that uses
> template1 as the template and only generates DDL for my tables and
> functions. How do I do this?
I hate to disillusion you, but there never has been any such behavior.
pg_dump can barely tell the built-in functions from yours; telling
ones that came from template1 additions apart from ones that were added
to the specific database is well beyond its powers.
What you might be able to do is segregate the template1 additions from
the local ones by schema, and then use schema dump restrictions.
regards, tom lane
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2007-12-17 22:07 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2007-12-17 18:50 pg_dump --create --schema-only, how to suppress template1 functions ? Scott Abel <sabel@yahoo.com>
2007-12-17 22:07 ` Tom Lane <tgl@sss.pgh.pa.us>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox