Re: Programatically switching database - Mailing list pgsql-sql

From Jan Wieck
Subject Re: Programatically switching database
Date
Msg-id 3FB6DE5B.1020000@Yahoo.com
Whole thread Raw
In response to Re: Programatically switching database  (ow <oneway_111@yahoo.com>)
Responses Re: Programatically switching database  (Jan Wieck <JanWieck@Yahoo.com>)
Re: Programatically switching database  (ow <oneway_111@yahoo.com>)
List pgsql-sql
ow wrote:

> --- ow <oneway_111@yahoo.com> wrote:
>> How? The doc only mentions db: pg_dump [option...] [dbname]
>> 
>> Then, how would I lock users out from the schema while it's being loaded?
> 
> Never mind how, I see there's "-n namespace" option in 7.4. But still, how
> would I lock users out from the schema while it's being loaded?

#!/bin/sh

(    echo "start transaction;"    cat $2    echo "commit transaction;"
) psql $1



then call it as

reload_in_transaction my_db my_namespace.dump

Since the whole dump will be restored inside of one transaction, nobody 
will see it while it's reloading.


Jan

-- 
#======================================================================#
# It's easier to get forgiveness for being wrong than for being right. #
# Let's break this rule - forgive me.                                  #
#================================================== JanWieck@Yahoo.com #



pgsql-sql by date:

Previous
From: ow
Date:
Subject: Re: Programatically switching database
Next
From: Jan Wieck
Date:
Subject: Re: Programatically switching database