pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
BUG #7587: createdb allows invalid DB names
2+ messages / 2 participants
[nested] [flat]

* BUG #7587: createdb allows invalid DB names
@ 2012-10-06 14:23  foss@johnbradshaw.org
  0 siblings, 1 reply; 2+ messages in thread

From: foss@johnbradshaw.org @ 2012-10-06 14:23 UTC (permalink / raw)
  To: 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=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






^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: BUG #7587: createdb allows invalid DB names
@ 2012-10-07 16:15  Tom Lane <tgl@sss.pgh.pa.us>
  parent: foss@johnbradshaw.org
  0 siblings, 0 replies; 2+ messages in thread

From: Tom Lane @ 2012-10-07 16:15 UTC (permalink / raw)
  To: foss@johnbradshaw.org; +Cc: pgsql-bugs

foss@johnbradshaw.org writes:
> 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.

This isn't a bug --- those utilities treat whatever's given on the
command line as being double-quoted.  Their documentation fails to
say this though :-(

			regards, tom lane




^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2012-10-07 16:15 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2012-10-06 14:23 BUG #7587: createdb allows invalid DB names foss@johnbradshaw.org
2012-10-07 16:15 ` Tom Lane <tgl@sss.pgh.pa.us>

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