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

Restoring dump of multiuser databases

All of my non-superusers are restricted from creating databases.
Whenever I upgrade Postgres, I have to hand-edit my dump and change:

CREATE USER usr1 WITH SYSID 101 PASSWORD '...' NOCREATEDB NOCREATEUSER;

into:

CREATE USER usr1 WITH SYSID 101 PASSWORD '...' CREATEDB NOCREATEUSER;

and then after the restore, I do a:

UPDATE pg_shadow SET usecreatedb=false WHERE usesysid <> 1;

Is there an easier way? Or would it make more sense if pg_dumpall
generates this:

\connect template1 postgres
CREATE DATABASE db1 WITH TEMPLATE=template0 ENCODING = 'SQL_ASCII';
UPDATE pg_database SET datdba=101 WHERE datnam='db1';
\connect db1 usr1
...
CREATE TABLE ( ... );

instead of this:

\connect template1 usr1
CREATE DATABASE db1 WITH TEMPLATE=template0 ENCODING = 'SQL_ASCII';
\connect db1 usr1
...
CREATE TABLE ( ... );

That is, the superuser creates the database for the normal user, and
then set the owner to the normal user. This way, the normal user doesn't
have to create the database himself.

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

Nov 23 '05 #1
2 1314
David Garamond <li***@zara.6.isreserved.com> writes:
Is there an easier way?


Use a newer version? pg_dumpall hasn't done it that way since 7.2.

regards, tom lane

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

Nov 23 '05 #2
Tom Lane wrote:
David Garamond <li***@zara.6.isreserved.com> writes:
Is there an easier way?


Use a newer version? pg_dumpall hasn't done it that way since 7.2.


I see. I did upgrade from 7.2 to 7.4.

Thanks.
--
dave

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

http://archives.postgresql.org

Nov 23 '05 #3

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

Similar topics

7
by: Adam Smith | last post by:
Hope this is the right news group!! I did a server upgrade and at the same time did a mysql update from 4.0.12 to Ver 12.22 Distrib 4.0.16 mach1# mysql --version mysql Ver 12.22 Distrib...
0
by: Kim | last post by:
How do I restore a single database (selectively) from a mysql dump of many databases. ie: I have a server with a few databases on it, I have run: mysqldump --all-databases > all_databases.sql ...
2
by: Raffi | last post by:
I use the --all-databases switch to backup my entire database. Sometimes there's a need to restore individual databases or tables form the backup file. What command should I use for this? ...
4
by: Raffi | last post by:
Hi, I'm developing a database application that uses numeric databases. At this point not using numeric databases is not an option. Doing a mysqldump works. However when trying to restore the...
1
by: Brian Sadler | last post by:
Does anyone know where I can find information on how to setup my shell in unix/linux to allow me to restore a database from an sql dump... Example... I have a database on 83200.mysql.com ...
5
by: Mike Nolan | last post by:
I have a 600K row table on my production system (running 7.3.3) that I dump and load on my development system (7.4.1) every night using cron jobs. I would like to be able to restore the table...
4
by: Együd Csaba | last post by:
Hi, the restoration of a dump stops at the line above. The dump was created with pgsql 7.3.2 and I need to pump it into a 7.4.3 one. Should anybody tell me what the problem can be and how I can...
2
by: chenert | last post by:
Hi all, im beginner to restoring dump files and postgresql as well so hope u could bear with me.! :D i have these dump files and i've been working on restoring everything in it. i've tried...
5
by: Troels Arvin | last post by:
Hello, Every so often, I'm asked to help people recover data from tables that were either dropped or where to much data was DELETEed. The complications related to restoring data are a problem....
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: 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
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
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.