473,383 Members | 1,788 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,383 software developers and data experts.

Creating schema copy

Hi,

In a database I have to create new schemas with exactely the same structure as
the default one. Of course, I could reverse a schema with pg_dump, then apply
the script to the newly created one. The problem is the base schema sometimes
changes so I should generate scripts every time. Also I need to do this from
a stored function.

My question: is it possible to extend (in near future) CREATE SCHEMA syntax
with feature like:
CREATE SCHEMA user_xxx_schema FROM default_user_schema [WITH CONTENT];
?
It should create *every* object existing in 'default_user_schema' in
'user_xxx_schema' preserving of course names, constraints, triggers, etc.
Optionally it could also copy table contents (but this is not very
important).

Or is there any other (relatively simple and safe) way do do this *inside* a
stored function (pl/pgsql)?

Regards,

Mariusz

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

http://archives.postgresql.org

Nov 23 '05 #1
1 6372
Mariusz =?iso-8859-2?q?Czu=B3ada?= <ma****@idea.net.pl> writes:
My question: is it possible to extend (in near future) CREATE SCHEMA syntax
with feature like:
CREATE SCHEMA user_xxx_schema FROM default_user_schema [WITH CONTENT];
?
It should create *every* object existing in 'default_user_schema' in
'user_xxx_schema' preserving of course names, constraints, triggers, etc.
Optionally it could also copy table contents (but this is not very
important).


AFAICS this would require a code body approximately as large,
complicated, and maintenance-needy as pg_dump itself; and being inside
the backend, it could share little or no physical code with pg_dump.

So no, it's not very likely to happen in the near future. pg_dump is
your best bet.

regards, tom lane

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

http://archives.postgresql.org

Nov 23 '05 #2

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

Similar topics

0
by: Jeremy Summers | last post by:
Has anyone run into problems creating typed datasets from complex schemas? I am attempting to create a Typed Dataset in Visual Studio .Net from a .xsd schema file for a industry standard web...
2
by: Mike:o | last post by:
I need to validate XML documents (orders) against their schema before processing. The PurchaseOrder schema that we use references 3 other schemas using the <imports ...> element. Here is the...
6
by: LesleyW | last post by:
Hi Apologies if this is a really dumb question, but being new to XML and Schemas, I wonder if giving the namespace for eg xsd or xsi as a website address means that the user has to be online...
3
by: Kiran | last post by:
Hi, I want to back up my data in some table in SQL server and import it back using Bulk Load of SQL server 2K. I can use the following code to backup the data in XML ...
3
by: Sindarian | last post by:
I have a Schema from the folk that shows how they want the data received. I have my own database that has that data, but in a different way (they use 33 freaking tables to store what I do in 1)....
2
by: pshvarts | last post by:
(I'm new in SOAP) I get some wsdl file (from apache service ). I tried creating SOAP client with .NET - trying to add Web Reference and get error like: "Custom tool error: Unable to import...
10
by: cj | last post by:
I have lots of tables to copy from one server to another. The new tables have been created to match the old ones. I practiced with one table. I created the select command (select * from tableA)...
4
by: RSH | last post by:
Hi, I have a situation where I have created a little application that makes an Access database from a SQL Database for reporting purposes. it does the job well, but it seems a bit slow. Is...
1
by: Himself | last post by:
I apologize if this has been answered before, I couldn't find it. I'm trying to transform XML to XML and specify a schema in the output XML. I am transforming nodes to different local names...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
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
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
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: 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: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

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.