Re: [HACKERS] Createdb problem report - Mailing list pgsql-hackers

From Bruce Momjian
Subject Re: [HACKERS] Createdb problem report
Date
Msg-id 199911182146.QAA12254@candle.pha.pa.us
Whole thread Raw
In response to Createdb problem report  ("Oliver Elphick" <olly@lfix.co.uk>)
Responses Re: [HACKERS] Createdb problem report
List pgsql-hackers
Applied.  Will appear in 7.0


[Charset iso-8859-1 unsupported, filtering to ASCII...]
> The attached report is still correct as of 6.5.3; but will having a
> database name that has to be quoted cause problems anywhere that SQL
> queries are constructed to do internal operations?
> 
> The SQL command `CREATE DATABASE "www-data"' works correctly.
> 
> ------- Forwarded Message
> 
> Date:    Thu, 18 Nov 1999 20:39:51 +0100
> From:    Eric Gentilini <eric.gentilini@eleve.emn.fr>
> To:      olly@lfix.co.uk
> Subject: [POSTGRESQL] Does createdb belong to postgresql ?
> 
> hi !
> 
> I fixed a _very_ little bug in createdb and destroydb that prevents the
> creation of postgresql users whose name contains special characters, and
> especially '-', useful when accessing a database through a CGI script, whose
> user is 'www-data' by default.
> 
> But I don't know if this prog is debian specific or if it belongs to
> postrgesql.
> 
> Can you help me ?
> thx !
> 
> 
> ============================================================================
>                         POSTGRESQL BUG REPORT TEMPLATE
> ============================================================================
> 
> 
> Your name               :       Eric Gentilini
> Your email address      :       eric.gentilini@eleve.emn.fr
> 
> 
> System Configuration
> - ---------------------
>   Architecture (example: Intel Pentium)         : Intel Pentium&PentiumII
> 
>   Operating System (example: Linux 2.0.26 ELF)  : Linux 2.2.13 ELF
> 
>   PostgreSQL version (example: PostgreSQL-6.5.2): PostgreSQL-6.5.2 
> 
>   Compiler used (example:  gcc 2.8.0)           : not compiled by me
> 
> 
> Please enter a FULL description of your problem:
> - ------------------------------------------------
> I don't know if it is really a bug or if it is intentionnal, but
> I found out that createdb and destroydb prevented the
> creation/destruction of postgresql users whose
> name contained special characters, and
> especially '-', useful when accessing a database through a CGI script, whose
> user is 'www-data' by default.
> (In this case, createdb is executed by createuser)
> The query aborts with the message "ERROR:  parser: parse error at or near "-""
> 
> Please describe a way to repeat the problem.   Please try to provide a
> concise reproducible example, if at all possible: 
> - ----------------------------------------------------------------------
> for instance : createdb www-data
> 
> 
> If you know how this problem might be fixed, list the solution below:
> - ---------------------------------------------------------------------
> The simplest solution I found is to modify the scripts createdb and destroydb.
> createdb : replace line 114 with :
> psql $PASSWDOPT -tq $AUTHOPT $PGHOSTOPT $PGPORTOPT -c "create
> database \"$dbname\" $location $encoding" template1
>         ^^^      ^^^
> destroydb : replace line 78 with :
> psql -tq $AUTHOPT $PGHOSTOPT $PGPORTOPT -c "drop database \"$dbname\"" template
> 1
>                                                          ^^^      ^^^
> 
> Eric (Yam) Gentilini
> 
> Linux _ Nantes sur http://www.linux-nantes.fr.eu.org
> 
> 
> ------- End of Forwarded Message
> 
> 
> -- 
>       Vote against SPAM: http://www.politik-digital.de/spam/
>                  ========================================
> Oliver Elphick                                Oliver.Elphick@lfix.co.uk
> Isle of Wight                              http://www.lfix.co.uk/oliver
>                PGP key from public servers; key ID 32B8FAA1
>                  ========================================
>      "A Song for the sabbath day. It is a good thing to 
>       give thanks unto the LORD, and to sing praises unto 
>       thy name, O most High."   Psalms 92:1 
> 
> 
> 
> ************
> 


--  Bruce Momjian                        |  http://www.op.net/~candle maillist@candle.pha.pa.us            |  (610)
853-3000+  If your life is a hard drive,     |  830 Blythe Avenue +  Christ can be your backup.        |  Drexel Hill,
Pennsylvania19026
 


pgsql-hackers by date:

Previous
From: "Oliver Elphick"
Date:
Subject: Createdb problem report
Next
From: Peter Eisentraut
Date:
Subject: psql & regress tests