Skip site navigation (1) Skip section navigation (2)

BUG #7587: createdb allows invalid DB names

From: foss(at)johnbradshaw(dot)org
To: pgsql-bugs(at)postgresql(dot)org
Subject: BUG #7587: createdb allows invalid DB names
Date: 2012-10-06 14:23:23
Message-ID: E1TKVHn-0007tu-Nq@wrigleys.postgresql.org (view raw or flat)
Thread:
Lists: pgsql-bugs
The following bug has been logged on the website:

Bug reference:      7587
Logged by:          John Bradshaw
Email address:      foss(at)johnbradshaw(dot)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(at)dev2:~$ psql -V
psql (PostgreSQL) 9.1.6
contains support for command-line editing

postgres(at)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(at)dev2:~$ createdb badname.sql

postgres(at)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(at)dev2:~$ dropdb badname.sql




Responses

pgsql-bugs by date

Next:From: dracoDate: 2012-10-07 12:08:12
Subject: BUG #7588: pgsql 9.1 incompatible with zlib 1.27
Previous:From: franco.ricciDate: 2012-10-06 14:14:47
Subject: BUG #7586: PL/Perl problem

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group