[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

samizdat-create-database : patch for postgresql-7.4.7

From: boud
Subject: samizdat-create-database : patch for postgresql-7.4.7
Date: Wed, 31 Jan 2007 22:24:21 +0100 (CET)

hi samizdat-devel,

createuser in postgresql 7.4.7 has -A instead of -S and does not have -R

IMHO it would be better that the database creation script has a fallback
option in case the user does not have a relatively recent version
of postgresql.

So in this patch, i've put  createuser -AD as a fallback option in case
createuser -SDR fails.

It's not perfect, and not good enough for this to be part of a full
debian install, because if the fallback happens, then although the
sysadmin installing will end up with a postgres database and user, a
careful novice sysadmin might become (unnecessarily) concerned about the error
message given out due to the failure of createuser -SDR. Some people *do*
actually read error messages and worry about them...

(On the other hand, i understand why the -SDR options were introduced - partly
in response to my questions as a novice concerned about what to answer to
the questions about what privileges the user should have.)

Anyway, here's the patch.


--- /scratch2/boud/samizdat_cvs/sources/samizdat/bin/samizdat-create-database   
2006-11-27 09:28:41.000000000 +0100
+++ samizdat-create-database    2007-01-31 22:03:36.980417464 +0100
@@ -45,7 +45,7 @@
                        exit 3
                echo "Creating database and user..."
-               su -c "createdb --encoding UNICODE '$SITE' && createlang plpgsql '$SITE' 
&& createuser -SDR '$SITE'" - postgres
+               su -c "createdb --encoding UNICODE '$SITE' && createlang plpgsql '$SITE' 
&& (createuser -SDR '$SITE' || createuser -AD '$SITE')" - postgres
                echo "Generating database schema..."
                echo "$SQL" | su -c "psql -q '$SITE' 2>/dev/null" - postgres

reply via email to

[Prev in Thread] Current Thread [Next in Thread]