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

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 "anotheruser" (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 9739
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
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...
3
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...
4
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...
1
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...
2
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
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,...
2
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
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
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...
4
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...
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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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: 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...
0
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,...
0
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...
0
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.