473,378 Members | 1,346 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

dump schema schema only?

I have a development server where I, well, do my development. Occasionally,
I will create a new schema within an existing database that I would like to
use on my production machine. I know that doing a pg_dump -s <database>
somefile.sql will dump the entire schema of the database, but is there a

way to export only schema X from the database?

TIA
Patrick Hatcher

---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddressHere" to ma*******@postgresql.org)

Nov 12 '05 #1
6 11227

You can use -t to specify a table:

% pg_dump -s database -t tablename
-Rick

-----Original Message-----
From: pg*****************@postgresql.org
[mailto:pg*****************@postgresql.org]On Behalf Of Patrick
Hatcher
Sent: Wednesday, October 29, 2003 12:57 PM
To: pg***********@postgresql.org
Subject: [GENERAL] dump schema schema only?
I have a development server where I, well, do my development.
Occasionally,
I will create a new schema within an existing database that I would
like to
use on my production machine. I know that doing a pg_dump -s
<database>
somefile.sql will dump the entire schema of the database, but is

there a
way to export only schema X from the database?

TIA
Patrick Hatcher

---------------------------(end of
broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddressHere" to
ma*******@postgresql.org)


---------------------------(end of broadcast)---------------------------
TIP 8: explain analyze is your friend

Nov 12 '05 #2
"Patrick Hatcher" <PH******@macys.com> writes:
I have a development server where I, well, do my development. Occasionally,
I will create a new schema within an existing database that I would like to
use on my production machine. I know that doing a pg_dump -s <database>
somefile.sql will dump the entire schema of the database, but is there a

way to export only schema X from the database?


7.4's pg_dump has an option to dump the contents of just one schema.

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 8: explain analyze is your friend

Nov 12 '05 #3
In article <20**************@sss.pgh.pa.us>,
Tom Lane <tg*@sss.pgh.pa.us> writes:
"Patrick Hatcher" <PH******@macys.com> writes:
I have a development server where I, well, do my development. Occasionally,
I will create a new schema within an existing database that I would like to
use on my production machine. I know that doing a pg_dump -s <database>
> somefile.sql will dump the entire schema of the database, but is there a way to export only schema X from the database?

7.4's pg_dump has an option to dump the contents of just one schema.


The pg_dump manpage of beta4 does not include this option, although
the source code does. Has this been fixed in beta5?
---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://archives.postgresql.org

Nov 12 '05 #4
Harald Fuchs <no****@sap.com> writes:
Tom Lane <tg*@sss.pgh.pa.us> writes:
7.4's pg_dump has an option to dump the contents of just one schema.
The pg_dump manpage of beta4 does not include this option,


Sure it does:

-n namespace
--schema=schema

Dump the contents of schema only. If this option is not specified,
all non-system schemas in the target database will be dumped.

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faqs/FAQ.html

Nov 12 '05 #5
Harald Fuchs wrote:
In article <20**************@sss.pgh.pa.us>,
Tom Lane <tg*@sss.pgh.pa.us> writes:
"Patrick Hatcher" <PH******@macys.com> writes:
I have a development server where I, well, do my development. Occasionally,
I will create a new schema within an existing database that I would like to
use on my production machine. I know that doing a pg_dump -s <database>
> somefile.sql will dump the entire schema of the database, but is there a
way to export only schema X from the database?

7.4's pg_dump has an option to dump the contents of just one schema.


The pg_dump manpage of beta4 does not include this option, although
the source code does. Has this been fixed in beta5?


Really? Perhaps we haven't updated the manual pages, but the SGML is
OK. I have added this to the list to be done before 7.4 final.

--
Bruce Momjian | http://candle.pha.pa.us
pg***@candle.pha.pa.us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073

---------------------------(end of broadcast)---------------------------
TIP 7: don't forget to increase your free space map settings

Nov 12 '05 #6
Tom Lane wrote:
Harald Fuchs <no****@sap.com> writes:
Tom Lane <tg*@sss.pgh.pa.us> writes:
7.4's pg_dump has an option to dump the contents of just one schema.

The pg_dump manpage of beta4 does not include this option,


Sure it does:

-n namespace
--schema=schema

Dump the contents of schema only. If this option is not specified,
all non-system schemas in the target database will be dumped.


I thought he was complaining because our 'man' output wasn't updated for
7.4. I just checked beta5's man.tar.gz, and it has the 7.3 contents,
and doesn't mention -n/--schema. I have added to our open items list:

Update manual pages.

--
Bruce Momjian | http://candle.pha.pa.us
pg***@candle.pha.pa.us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073

---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://archives.postgresql.org

Nov 12 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Thomas Marti | last post by:
Hello I have the following problem: I want to have an XML-Schema that only declares one Attribute, but does not specify in which specific Element it has to be used. I've already tried the...
0
by: Robert Jacobson | last post by:
Hi, I have a number of classes in one assembly. I'd like to use XSD.exe to generate a schema for just one class ("Parse Rules") and its nested child classes. Is there an attribute that will...
6
by: btober | last post by:
Is there a way to get a dump of all the DDL and data associated with a single schema within a database? What I tried in attempting to hack this out was \dt consume.* and \dv consume.*
0
by: Glenn Davy | last post by:
Hi all Is there a command like backup ( or an option to backup) I can execute from osql to simply dump out a schema (a bit like pg_dump --schema-only in postgres). I'm sure there must be...
1
by: MLH | last post by:
Last month, I posted this... http://support.microsoft.com/d­efault.aspx?scid=kb;en-us;1009­73 shows Function Screendump(). It is code that effectively does the same thing as pressing...
6
by: Rory Campbell-Lange | last post by:
I think this is a suggestion/comment! pg_dump man page: --schema-only Dump only the schema (data definitions), no data I think this use of the word schema is confusing, meaning data...
1
by: raptor | last post by:
How to DUMP the Database schema, (so later can get it back i.e recreate everything). I need only the schema (tables, users, groups etc..) now (not the data, is it any different if i want the data...
2
by: Anony Mous | last post by:
Hi, I've seen in previous posts that recommended practice for database backup is to run the dump utility twice. Once for schema only and a second time for data only (I think). Up to know,...
1
by: korkless | last post by:
hi, i have a xml as <itemCollection> <item enabled="false" /> <item enabled="true" /> <item enabled="false" /> </itemCollection> I want know if exists a solution with xml schema for...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.