Createdb problem report

From: "Oliver Elphick" <olly(at)lfix(dot)co(dot)uk>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Createdb problem report
Date: 1999-11-18 21:19:33
Message-ID: 199911182119.VAA22284@linda.lfix.co.uk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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(dot)gentilini(at)eleve(dot)emn(dot)fr>
To: olly(at)lfix(dot)co(dot)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(dot)gentilini(at)eleve(dot)emn(dot)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(dot)Elphick(at)lfix(dot)co(dot)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

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 1999-11-18 21:46:30 Re: [HACKERS] Createdb problem report
Previous Message Brook Milligan 1999-11-18 15:20:19 Re: [HACKERS] rules use lztext - initdb required