pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: foss@johnbradshaw.org
To: pgsql-bugs@postgresql.org
Subject: BUG #7587: createdb allows invalid DB names
Date: Sat, 06 Oct 2012 14:23:23 +0000
Message-ID: <E1TKVHn-0007tu-Nq@wrigleys.postgresql.org> (raw)

The following bug has been logged on the website:

Bug reference:      7587
Logged by:          John Bradshaw
Email address:      foss@johnbradshaw.org
PostgreSQL version: 9.1.6
Operating system:   Ubuntu 12.04 LTS
Description:        

createdb allows illegal period/dot (".") in DB names.  Can't ALTER DATABASE
name in psql as it doesn't allow periods/dots in database names.  Had to
dropdb (which also allows dot in names) and recreate from dump.

Would be nice if createdb checked for illegal characters in DB names.

postgres@dev2:~$ psql -V
psql (PostgreSQL) 9.1.6
contains support for command-line editing

postgres@dev2:~$ sudo dpkg -l postgresql-9.1
Desired=Unknown/Install/Remove/Purge/Hold
|
Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name                                            Version                 
                       Description
+++-===============================================-===============================================-==============================================================================================================
ii  postgresql-9.1                                  9.1.6-0ubuntu12.04      
                       object-relational SQL database, version 9.1 server


postgres@dev2:~$ createdb badname.sql

postgres@dev2:~$ psql badname.sql
psql (9.1.6)
Type "help" for help.

badname.sql=# alter DATABASE badname.sql RENAME TO to goodname;
ERROR:  syntax error at or near "."
LINE 1: alter DATABASE badname.sql RENAME TO to goodname;
                              ^
badname.sql=# \q

postgres@dev2:~$ dropdb badname.sql






view thread (2+ messages)  latest in thread

Message-ID: <E1TKVHn-0007tu-Nq@wrigleys.postgresql.org>
Permalink:  ../E1TKVHn-0007tu-Nq@wrigleys.postgresql.org/
Also on:    postgresql.org/message-id/E1TKVHn-0007tu-Nq@wrigleys.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: foss@johnbradshaw.org
  Subject: Re: BUG #7587: createdb allows invalid DB names
  In-Reply-To: <E1TKVHn-0007tu-Nq@wrigleys.postgresql.org>
  References: <E1TKVHn-0007tu-Nq@wrigleys.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox