Skip site navigation (1) Skip section navigation (2)

Re: [HACKERS] initdb

From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: Postgresql Hackers <pgsql-hackers(at)postgresql(dot)org>,"Patches (PostgreSQL)" <pgsql-patches(at)postgresql(dot)org>
Subject: Re: [HACKERS] initdb
Date: 2003-10-01 21:10:51
Message-ID: 3F7B42DB.7080000@dunslane.net (view raw or flat)
Thread:
Lists: pgsql-hackerspgsql-patches
Peter Eisentraut wrote:

>Andrew Dunstan writes:
>
>  
>
>>So if the data directory previously existed and was empty, we don't
>>clean it out on error, even if we didn't use the noclean flag. Is this
>>intended behaviour or a bug? (If a bug it's trivially easy to fix.)
>>    
>>
>
>If the data directory already existed, we don't want to delete it.  We
>should possibly delete the content, though.
>
>  
>
yes, that's what I meant.

Here's a patch which should work, I think:

Index: src/bin/initdb/initdb.sh
===================================================================
RCS file: /projects/cvsroot/pgsql-server/src/bin/initdb/initdb.sh,v
retrieving revision 1.203
diff -c -w -r1.203 initdb.sh
*** src/bin/initdb/initdb.sh    27 Sep 2003 16:27:57 -0000      1.203
--- src/bin/initdb/initdb.sh    1 Oct 2003 21:06:07 -0000
***************
*** 44,49 ****
--- 44,53 ----
          if [ "$made_new_pgdata" = yes ]; then
              echo "$CMDNAME: removing data directory \"$PGDATA\"" 1>&2
              rm -rf "$PGDATA" || echo "$CMDNAME: failed" 1>&2
+         else
+             echo "$CMDNAME: removing contents of data directory 
\"$PGDATA\"" 1>&2
+             rm -rf "$PGDATA"/* || echo "$CMDNAME: failed" 1>&2
          fi
      else
          echo "$CMDNAME: data directory \"$PGDATA\" not removed at 
user's request" 1>&2



In response to

  • Re: initdb at 2003-10-01 20:54:32 from Peter Eisentraut

Responses

pgsql-hackers by date

Next:From: Tom LaneDate: 2003-10-01 21:36:28
Subject: Re: invalid tid errors in latest 7.3.4 stable.
Previous:From: Peter EisentrautDate: 2003-10-01 20:54:32
Subject: Re: initdb

pgsql-patches by date

Next:From: Joe ConwayDate: 2003-10-01 23:09:26
Subject: Re: tablefunc functions in postgresql
Previous:From: Peter EisentrautDate: 2003-10-01 20:54:32
Subject: Re: initdb

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group