X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 5D368D1C92F for ; Sun, 16 Nov 2003 02:22:23 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 40754-09 for ; Sat, 15 Nov 2003 22:21:55 -0400 (AST) Received: from smtp015.mail.yahoo.com (smtp015.mail.yahoo.com [216.136.173.59]) by svr1.postgresql.org (Postfix) with SMTP id 3B055D1C943 for ; Sat, 15 Nov 2003 22:21:51 -0400 (AST) Received: from pcp01341166pcs.wilog301.pa.comcast.net (HELO europa.janwieck.net) (janwieck@68.80.245.191 with login) by smtp.mail.vip.sc5.yahoo.com with SMTP; 16 Nov 2003 02:21:55 -0000 Received: from Yahoo.com (pcp01341166pcs.wilog301.pa.comcast.net [68.80.245.191]) (authenticated) by europa.janwieck.net (8.11.6/8.11.6) with ESMTP id hAG2Lro09990; Sat, 15 Nov 2003 21:21:53 -0500 Message-ID: <3FB6DF08.4040603@Yahoo.com> Date: Sat, 15 Nov 2003 21:20:56 -0500 From: Jan Wieck User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.4) Gecko/20030624 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Jan Wieck Cc: ow , Peter Eisentraut , pgsql-sql@postgresql.org Subject: Re: Programatically switching database References: <20031116015008.76880.qmail@web21402.mail.yahoo.com> <3FB6DE5B.1020000@Yahoo.com> In-Reply-To: <3FB6DE5B.1020000@Yahoo.com> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200311/180 X-Sequence-Number: 15995 Jan Wieck wrote: > ow wrote: > >> --- ow 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 gosh, there's the pipe missing before the psql > > > > 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 #