473,662 Members | 2,724 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

DDL for a single schema

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

to get a list of tables and views in the schema named "consume", then
sent those lists to a file "tables.txt ". Followed that with something
like

for n in `cat tables.txt` do; pg_dump -t $n >> consume.sql; done

This almost worked, except for that I have some duplicate table names in
other schemas, and the pg_dump picked up both the table I wanted in the
consume schema and the the similarly-named table in a different schema.
I'd really like to be able to get the complete dump for one schema and no
more. Might work if you could specify a schema-qualified table name in
the -t option of pg_dump, but that apparently is not possible currently.

I tried also using pg_restore to generate a list file, thinking I could
edit the output list file to include only the tables from desired schema.
This would really be a better approach than what I've show above, but
having the duplicate table names was again the problem because nothing in
the list file distinquishes which schema the tables are members of.

~Berend Tober


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

Nov 12 '05 #1
6 3098
On Friday 07 November 2003 18:53, bt****@seaworth ysys.com wrote:
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.*

to get a list of tables and views in the schema named "consume", then
sent those lists to a file "tables.txt ". Followed that with something
like

for n in `cat tables.txt` do; pg_dump -t $n >> consume.sql; done


pg_dump in 7.4 has the dump option. You need to use --schema as option.

Check developers documentation on web site or download RC1 and try out
yourself.

HTH

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

http://archives.postgresql.org

Nov 12 '05 #2
On Friday 07 November 2003 19:36, Shridhar Daithankar wrote:
On Friday 07 November 2003 18:53, bt****@seaworth ysys.com wrote:
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.*

to get a list of tables and views in the schema named "consume", then
sent those lists to a file "tables.txt ". Followed that with something
like

for n in `cat tables.txt` do; pg_dump -t $n >> consume.sql; done


pg_dump in 7.4 has the dump option. You need to use --schema as option.

Check developers documentation on web site or download RC1 and try out
yourself.


http://developer.postgresql.org/docs...pp-pgdump.html

Sorry for missing it first time..

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

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

Nov 12 '05 #3
On Friday 07 November 2003 19:36, Shridhar Daithankar wrote:
On Friday 07 November 2003 18:53, bt****@seaworth ysys.com wrote:
> Is there a way to get a dump of all the DDL and data associated

with a single schema within a database?
pg_dump in 7.4 has the dump option. You need to use --schema as
option.

Check developers documentation on web site or download RC1 and try
out
yourself.


http://developer.postgresql.org/docs...pp-pgdump.html

Sorry for missing it first time..

Shridhar


Thanks. Didn't have immediate plans to upgrade from 7.3. But I'll look
for that feature when the time comes.

~Berend Tober


---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to ma*******@postg resql.org

Nov 12 '05 #4
On Friday 07 November 2003 14:28, bt****@seaworth ysys.com wrote:
On Friday 07 November 2003 19:36, Shridhar Daithankar wrote:
On Friday 07 November 2003 18:53, bt****@seaworth ysys.com wrote:
> Is there a way to get a dump of all the DDL and data associated

with a single schema within a database?
pg_dump in 7.4 has the dump option. You need to use --schema as
option.
Thanks. Didn't have immediate plans to upgrade from 7.3. But I'll look
for that feature when the time comes.


I believe 7.4 pg_dump should work against a 7.3 database (and further back
IIRC).
--
Richard Huxton
Archonet Ltd

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

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

Nov 12 '05 #5
Richard Huxton <de*@archonet.c om> writes:
I believe 7.4 pg_dump should work against a 7.3 database (and further back
IIRC).


It will, but I don't think we guarantee that the output will load into a
pre-7.4 database --- pg_dump usually assumes its SQL output can take
advantage of all the features it knows about.

This might work more-or-less-okay for 7.3, but you'd better test before
depending on it.

regards, tom lane

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

Nov 12 '05 #6
On Fri, 2003-11-07 at 08:23, bt****@seaworth ysys.com wrote:
Is there a way to get a dump of all the DDL and data associated with a
single schema within a database?


The 7.4 pg_dump is capable of this task (--schema=SCHEMA) but you may
have difficulties restoring to a 7.3 backend.

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.3 (FreeBSD)

iD8DBQA/q6Tu6DETLow6vww RAjDsAJ98PhoDxt 7/tL7eRBqe1RjUo54 figCggtVi
NFduLYHXxPzQzJJ e5u8QxX0=
=jNcb
-----END PGP SIGNATURE-----

Nov 12 '05 #7

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

Similar topics

0
1416
by: kyancy | last post by:
Hello All. We have several XML schemas to describe common component document parts. We then create new XML schemas as necessary that use "xsd:import schemaLocation=whateverLocation.." to include the common type definitions from 1 or more of the component XML schemas rather than just explicitly adding the common definitions in every XML schema we create. This works great from a definition and validation point of view, but I
1
1486
by: John Smith | last post by:
Ok, I have 2 xml files that are really similar. They have the exact same structure exept that in one XML some element are required and in the other they are simply absent from the xml. Problem is in they are similar at 90% what I was looking for is a way to validate and say what "case" I want to test. For exemple in my XSD I somehow specify what apply to what and in the XML or simply at validation time I specify wich case I want to test.
3
6308
by: John Smith | last post by:
Ok, I am not sure if it is possible. But what I'm trying to do is validate an XML file with out having to add namespace in the xml. What I mean is lets say I have 2 XSD they have different namespaces and lvl2 is used in lvl using the import feature lvl1.xsd -> lvl2.xsd
2
5080
by: Tarren | last post by:
Hi: The problem I am having is when I validate an xml file to a schema, it is erroring out every element. I think this has something to do with me defining/referencing the namespaces. I have searched on the net for a while, but am still confused. Thanks in advance for help. Below is the code I am working with. What am I not referencing/referencing incorrectly? ===================================
19
2354
by: Steve Jorgensen | last post by:
I've run across this issue several times of late, and I've never come up with a satisfactory answer to the best way to handle this schema issue. You have a large section of schema in which a subset of records across all tables is often considered a separate logical system, but sometimes may be treaded ar part of the global system, and there is not simply a 1-m-m... tree among the records in a logical database. Here's an example. A...
1
2300
by: Wallace | last post by:
Hi all, I have a problem on validating a xml fragment using a single namespace schema which spread across multiple schema files using include in the master schema file. No matter how I change the xml fragment (to include default namespace xmlns='urn:xxx:yy' and any other namespace it may have), I still get the same error. 'urn:xxx:yy:Header' element is not declared. An error occurred at , (1, 2).
2
1208
by: jjouett | last post by:
We are starting to setup some Web Services to provide our customers with a way to programatically interact with our application, and some of our customers have slightly different requirements in the structure, format, and representation of the results for common requests. Of course, we have to comply with their formats, but it seems to be a bit of overkill to have multiple implementation methods and/or data objects that represent the...
5
2968
by: BMeyer | last post by:
I have been losing my mind trying to parse an XML document (with nested child elements, not all of which appear in each parent node) into a DataGrid object. What I want to do is "flatten" the XML document into a text document with a single row for each parent node (that has all of the values from all of the child nodes for that row) The DataView within VS 2005 IDE displays my 15 or so child tables - and knows that some parent rows...
2
2046
by: Bardo | last post by:
Hi all, Does anyone know if it is possible, and if so how, to perform validation of a simple non XML string against certain XSD restrictions, without having the entire XML document to validate against the schema. To elaborate - - Within XSD certain restrictions are defined for a particular element/attribute, such as datatype, minlength, maxlength, valid enumeration values etc. Is it at all possible to validate a simple string value...
0
8435
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8345
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8857
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8547
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
6186
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5655
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4181
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2763
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1754
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.