【发布时间】:2014-05-28 07:39:53
【问题描述】:
例如我的Postgresql 数据库名称是Ajp
我无法删除/创建具有此名称的数据库,即。 Ajp
我的 drop 脚本是
cd /D D:\\Apps
cd RSTAR PGSQL DOTCONNECT
cd bin
cd Debug
cd PG
psql -U postgres -d postgres -c "DROP DATABASE Ajp "
执行此操作时出现此错误
D:\Apps\RSTAR PGSQL DOTCONNECT\bin\Debug\PG>psql -U postgres -d postgres -c "DR OP 数据库 Ajp" 错误:数据库“ajp”不存在
我试过psql -U postgres -d postgres -c "DROP DATABASE 'Ajp' "(引号内的数据库名称)
又报错了
错误:“'Ajp'”处或附近的语法错误 第 1 行:删除数据库“Ajp”
如何解决这个问题?? (请不要评论change your dbname to lower-case)
using : "PostgreSQL 9.2.4, compiled by Visual C++ build 1600, 32-bit"
这个问题的解决方法如下
- 应该使用转义字符
\ -
psql -U postgres -d postgres -c "DROP DATABASE \"Ajp\";"
【问题讨论】:
-
我将评论你对混合大小写标识符的使用:这是一个很好的例子,为什么你不应该使用它们。
标签: postgresql psql