473,657 Members | 2,586 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Dump tables with pg_dump - no or different Owner

Hi!

Have a problem, probably easy to solve... I want to dump a database
which resides on my local server with another, and not existing, owner
than the one who actually owns it locally.

The beginning of the dump file looks like:

########
\connect - postgres

SET search_path = public, pg_catalog;

--
-- TOC entry 2 (OID 16978)
-- Name: ingrediens; Type: TABLE; Schema: public; Owner: postgres
########

I want all instances of "postgres" to be changed in the dump (only) to
for example "anotheruse r" (which will be the one on the remote server).

I'm having problem dumping from the first to the second server, and
suspects that the differing owners can be the key to solve the
problem...

In advance, lots of thanks,
sincerely:

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

http://archives.postgresql.org

Nov 12 '05 #1
1 9754
Victor Spång Arthursson wrote:
Have a problem, probably easy to solve... I want to dump a database
which resides on my local server with another, and not existing, owner
than the one who actually owns it locally.


If the whole database is going to be owned by one user, try dumping the
tables like this:

pg_dump --no-privileges --no-owner --no-reconnect ... > tables.sql

Then load the tables as the new owner on the new database.

An alternative is to process the SQL dump using perl:

perl -p -i -e 's/old-owner-name/new-owner-name/g' tables.sql
HTH
Alex Satrapa
---------------------------(end of broadcast)---------------------------
TIP 8: explain analyze is your friend

Nov 12 '05 #2

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

Similar topics

4
19854
by: Wade Chy | last post by:
Hi All I am in a situation where I have to grant select privileges on tables owned by a different owner to a specific role. I am logged in as system/sysdba. I have created a new role FIN_READ_ONLY. I need to grant SELECT privileges on all the existing and future tables owned by FIN. I tried to grant SELECT on FIN.ACCT_REF to FIN_READ_ONLY. But was not successful due to insufficient privileges since SYSTEM does not own the table or dont...
3
4082
by: Dov MORYUSEF | last post by:
Hi there, Is it possible to have a primary key - foreign key relationship between tables in different databases in DB2 ? (databases are installed in different physical servers) Thanks a lot for your answers Dov MORYUSEF
4
2470
by: Heather | last post by:
I am creating a database with a backend and frontend. The backend consists of a Products table and many other tables. The products table in an .mdb file by itself is over 2 meg. I thought about putting the products table in a file by itself and all the other tables in another file. I anticipate there will be a need for changes in the other tables and since communication is over the internet, having the products table in a different file...
1
6119
by: bitwxtadpl | last post by:
-First I add and relate the tables A and B. Create a new instance of TableA Add TableA to DataSetX Create a new instance of TableB Add TableB to DataSetX Create a relation between TableA and TableB At this point I can connect the DataSet to a DataGrid and everything works fine, I can browse the connected tables without any errors.
2
2804
by: zwasdl | last post by:
I'm using access to connect to Oracle via ODBC. I can also connect to Oracle via sql*plus. Can I write a query to join tables from different schema? If so, how? Thanks a million! Wei
1
2631
by: nights | last post by:
hi! i'm just a newbie with php and mysql... and i'm having problems joining tables from different databases... can you please help me? here's my query: SELECT database1.table1.field1, database1.table1.field2, database1.table1.field3, database1.table1.field4, database1.table1.field5, database2.table1.field1, database2.table1.field2
2
2957
by: =?Utf-8?B?VGVycnk=?= | last post by:
Is it possible to join tables from different databases? If so, what is the format of the select statement? Both databases are on the same server. TIA, -- Terry
2
2938
by: krishnasarma | last post by:
hi can any one tell me ........how to join two tables of different db(MSAccess) in Vb6 thanx in advance
3
2380
by: sudhashekhar30 | last post by:
hi all i am using formview control(asp.net 2.0) 1rst time. don't know much about it. i want to display record in it from different tables at different time. like 1rst time form view is showing record of tableEmp. 2nd time same formview showing record of tableSalary.i am using c# coding. is it possible to bind data from code behind file? if possible, how? i would also like to know how i can bind formview from datagrid(select event) thanks....
4
2879
by: CJ Jarvis | last post by:
Hello - I am trying to summarize two tables with different setups in a report. I am entering payments by periods. Field names are as follows: PaymentNumber = Payment 1, Payment 2, Payment 3.. Period = P1, P2, P3... FiscalYear = 2010, 2011, 2012.. PaymentAmount = dollar amount for the period
0
8305
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,...
1
8503
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,...
0
8605
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6163
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
5632
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
4301
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2726
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
1950
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1607
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.