Re: Programatically switching database

From: Jan Wieck <JanWieck(at)Yahoo(dot)com>
To: ow <oneway_111(at)Yahoo(dot)com>
Cc: Peter Eisentraut <peter_e(at)gmx(dot)net>, pgsql-sql(at)postgresql(dot)org
Subject: Re: Programatically switching database
Date: 2003-11-16 02:18:03
Message-ID: 3FB6DE5B.1020000@Yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

ow wrote:

> --- ow <oneway_111(at)yahoo(dot)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(at)Yahoo(dot)com #

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Jan Wieck 2003-11-16 02:20:56 Re: Programatically switching database
Previous Message ow 2003-11-16 01:50:08 Re: Programatically switching database