Reputation: 2619
I'm using PostgreSql 9.2. Trying to do
ALTER DATABASE 3_8_dev_test6 RENAME TO 3_8_dev_test
but get:
ERROR: syntax error at or near "3"
LINE 1: ALTER DATABASE 3_8_dev_test6 RENAME TO 3_8_dev_test
So what's wrong?
Upvotes: 1
Views: 1824
Reputation: 80111
Postgres assumes you're going to enter a number in this case so if you want to have numbers in the beginning of a name, use quotes :)
In this case:
ALTER DATABASE "3_8_dev_test6" RENAME "TO 3_8_dev_test";
Upvotes: 2
Reputation: 125524
If the name really starts with a number then use double quotes
ALTER DATABASE "3_8_dev_test6" RENAME TO "3_8_dev_test"
But then you will have to match the case also
http://www.postgresql.org/docs/current/static/sql-syntax-lexical.html#SQL-SYNTAX-IDENTIFIERS
Upvotes: 2