pg.ddx.io pgsql-general@postgresql.org mailing list archive
help / color / mirror / Atom feeda database can be created but not droped
3+ messages / 3 participants
[nested] [flat]
* a database can be created but not droped
@ 2022-08-01 09:22 Matthias Apitz <guru@unixarea.de>
0 siblings, 2 replies; 3+ messages in thread
From: Matthias Apitz @ 2022-08-01 09:22 UTC (permalink / raw)
To: pgsql-general@lists.postgresql.org
Hello,
This is with 14.1 on Linux. I have created a new database with
$ createdb -U sisis -T template0 SRP-27097
I can connect to it, created tables and fill them with SQL:
$ psql -Usisis -dSRP-27097
psql (14.1)
Geben Sie »help« für Hilfe ein.
SRP-27097=# select count(*) from sisisinst;
count
-------
2
but I can not drop the database:
$ psql -Usisis -dtestdb
psql (14.1)
Geben Sie »help« für Hilfe ein.
testdb=# DROP DATABASE IF EXISTS SRP-27097 WITH FORCE;
ERROR: syntax error at or near "-"
ZEILE 1: DROP DATABASE IF EXISTS SRP-27097 WITH FORCE;
Why is this?
matthias
--
Matthias Apitz, ✉ guru@unixarea.de, http://www.unixarea.de/ +49-176-38902045
Public GnuPG key: http://www.unixarea.de/key.pub
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: a database can be created but not droped
@ 2022-08-01 09:27 Julien Rouhaud <rjuju123@gmail.com>
parent: Matthias Apitz <guru@unixarea.de>
1 sibling, 0 replies; 3+ messages in thread
From: Julien Rouhaud @ 2022-08-01 09:27 UTC (permalink / raw)
To: Matthias Apitz <guru@unixarea.de>; +Cc: pgsql-general@lists.postgresql.org
Hi,
On Mon, Aug 01, 2022 at 11:22:33AM +0200, Matthias Apitz wrote:
>
> This is with 14.1 on Linux. I have created a new database with
>
> $ createdb -U sisis -T template0 SRP-27097
>
> I can connect to it, created tables and fill them with SQL:
>
> but I can not drop the database:
>
> $ psql -Usisis -dtestdb
> psql (14.1)
> Geben Sie »help« für Hilfe ein.
>
> testdb=# DROP DATABASE IF EXISTS SRP-27097 WITH FORCE;
> ERROR: syntax error at or near "-"
> ZEILE 1: DROP DATABASE IF EXISTS SRP-27097 WITH FORCE;
>
> Why is this?
It's because createdb a command that knows how to quote identifiers and will do
automatically for you. At the SQL level you have to properly quote identifier,
so this command will work:
DROP DATABASE IF EXISTS "SRP-27097" WITH FORCE;
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: a database can be created but not droped
@ 2022-08-01 09:30 Frank Streitzig <fstreitzig@gmx.net>
parent: Matthias Apitz <guru@unixarea.de>
1 sibling, 0 replies; 3+ messages in thread
From: Frank Streitzig @ 2022-08-01 09:30 UTC (permalink / raw)
To: Matthias Apitz <guru@unixarea.de>; +Cc: pgsql-general@lists.postgresql.org
Am Mon, Aug 01, 2022 at 11:22:33AM +0200 schrieb Matthias Apitz:
> testdb=# DROP DATABASE IF EXISTS SRP-27097 WITH FORCE;
> ERROR: syntax error at or near "-"
> ZEILE 1: DROP DATABASE IF EXISTS SRP-27097 WITH FORCE;
>
> Why is this?
Please try: DROP DATABASE IF EXISTS "SRP-27097" WITH FORCE;
Best rehards
Frank
^ permalink raw reply [nested|flat] 3+ messages in thread
end of thread, other threads:[~2022-08-01 09:30 UTC | newest]
Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2022-08-01 09:22 a database can be created but not droped Matthias Apitz <guru@unixarea.de>
2022-08-01 09:27 ` Julien Rouhaud <rjuju123@gmail.com>
2022-08-01 09:30 ` Frank Streitzig <fstreitzig@gmx.net>
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