BUG #7587: createdb allows invalid DB names - Mailing list pgsql-bugs

From foss@johnbradshaw.org
Subject BUG #7587: createdb allows invalid DB names
Date
Msg-id E1TKVHn-0007tu-Nq@wrigleys.postgresql.org
Whole thread Raw
Responses Re: BUG #7587: createdb allows invalid DB names  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-bugs
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=3DUnknown/Install/Remove/Purge/Hold
|
Status=3DNot/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-p=
end
|/ Err?=3D(none)/Reinst-required (Status,Err: uppercase=3Dbad)
||/ Name                                            Version                 =

                       Description
+++-=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D-=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D-=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D
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=3D# 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=3D# \q

postgres@dev2:~$ dropdb badname.sql

pgsql-bugs by date:

Previous
From: draco@marino.st
Date:
Subject: BUG #7588: pgsql 9.1 incompatible with zlib 1.27
Next
From: Tom Lane
Date:
Subject: Re: BUG #7587: createdb allows invalid DB names