Results 1 to 2 of 2
  1. #1
    Join Date
    Jan 2014
    Posts
    2

    Unanswered: How to delete database with "carriage return or new line" in its name

    While creating database, I accidentally hit <enter>. Database is got created as follows.

    postgres@bardaba:~$ createdb -E Unicode "test
    ";

    psql -l shows database name as "test +"

    List of databases
    Name | Owner | Encoding | Collate | Ctype | Access privileges
    -----------+----------+----------+---------+-------+-----------------------
    test +| postgres | UTF8 | C | C |

    Question is how can I delete this database? I'm not able to delete it using "test +" or any other ways.
    Last edited by bardaba; 01-29-14 at 14:14.

  2. #2
    Join Date
    Jan 2014
    Posts
    2

    Re: How to delete database with "carriage return or new line

    I found the answer. Here it is for those who are curious.

    We need to use unicode for line feed that was introduced as typo!

    To drop a database: drop database U&"test\000A";
    To alter a database name: alter database U&"test\000A" rename to "mytest3";

    hth,
    bardaba

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •