List Info

Thread: samizdat-create-database : patch for postgresql-7.4.7




samizdat-create-database : patch for postgresql-7.4.7
user name
2007-01-31 15:24:21
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.

cheers
boud



---
/scratch2/boud/samizdat_cvs/sources/samizdat/bin/samizdat-cr
eate-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
  		fi
  		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
  		echo



_______________________________________________
samizdat-devel mailing list
samizdat-develnongnu.org
http://lists.nongnu.org/mailman/listinfo/samizdat-devel

Re: samizdat-create-database : patch for postgresql-7.4.7
user name
2007-02-18 08:01:15
On 1/31/07, boud <boudriseup.net> wrote:
> createuser in postgresql 7.4.7 has -A instead of -S and
does not have -R
...
> So in this patch, i've put  createuser -AD as a
fallback option in case
> createuser -SDR fails.

The right thing to do is to check the output of `createuser
--version`, and use the right set of options depending on
whether the
version number starts with "7." or
"8.".

Boud, can you update your patch to do that, please?

-- 
Dmitry Borodaenko


_______________________________________________
samizdat-devel mailing list
samizdat-develnongnu.org
http://lists.nongnu.org/mailman/listinfo/samizdat-devel

[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )