Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oIRiU-0005ZJ-E5 for pgsql-general@arkaria.postgresql.org; Mon, 01 Aug 2022 09:28:02 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1oIRiS-0000EV-W8 for pgsql-general@arkaria.postgresql.org; Mon, 01 Aug 2022 09:28:00 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oIRiS-0000E0-J1 for pgsql-general@lists.postgresql.org; Mon, 01 Aug 2022 09:28:00 +0000 Received: from mail-pf1-x431.google.com ([2607:f8b0:4864:20::431]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1oIRiQ-00054z-KV for pgsql-general@lists.postgresql.org; Mon, 01 Aug 2022 09:27:59 +0000 Received: by mail-pf1-x431.google.com with SMTP id z187so157306pfb.12 for ; Mon, 01 Aug 2022 02:27:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to; bh=t1RvmT0TKTQvltJHfepDIbA5n1Ru9QDi6iAEC1gFIFM=; b=QiyXwcyo13KqIhCHQ5lACbUB3EkTxT4afzK8OGr5PvrYZO1112VpEmXe05Qrx53ucd XxtdJgPIw/Y50qcSebp13X+6uf5Rx40fL4ZBFrknCfwUU9FdWxlv/JxPnCELwPBpCak8 lHvtrPy7d0mr47ArJmk1LrlfIg6tTLs61FEpX72uSsEu1vWJarQap/n4e88q1bySYDVT aCiyvA8/u70nwnkbU+yLfC2qeJ/dbRRSRhNQ1hOJ9upKEckz7Oa2T1UMrko8ax9Sx3oj jZUprt+0ykdVqiAOaPLvzDwNasY7PZpZqTTBrhrQgPbDae8PLXbZFhAS/w4ALmBes9O6 ZeLg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to; bh=t1RvmT0TKTQvltJHfepDIbA5n1Ru9QDi6iAEC1gFIFM=; b=tuOpIyTfoaPTxzjFxi+4+KWuvzBSseZXl/orq2eXprOGmSasUDxdQ/d6lghLIk+vq5 SbK+rZmix/rYrTSo1pz6k+/qoJKpePu9b7ck8+lpH5BCgzPpcDStvFm0crGOWROj8zhs kj8iU5rowDpV+czuYFqjdVZtmeuB6LVGWboXV1qwXmRGMJXPrEX25QgylsOyxMTyrGX0 ChdXcSIJLBdQjjuFEck27tpxYVDqjxw0b09DvDqpadKXOlqpmgaOa7BrFPdliq68kKUC e4rtA969658NS8jPLJ/AYtnSaxFrzo+G+2WUuZGEbVRGLWzZVYxthc0xUVeVYwGlAi9Z t02g== X-Gm-Message-State: ACgBeo323gf2D7kSEDcXkGopR4oFfsWL3MZ/LN0CwbHLnTCvfMXc3upU lp14VGEi6QP6RD6uUbmk5wuJfeBs0eA= X-Google-Smtp-Source: AA6agR7vkAdRbns24puhsobKQL0TNUuIjxvxqdSLqm807weW9G9vbM93FGy2uc9igoYmhenwXr/LNA== X-Received: by 2002:aa7:95a8:0:b0:52d:4185:198d with SMTP id a8-20020aa795a8000000b0052d4185198dmr6850161pfk.65.1659346077223; Mon, 01 Aug 2022 02:27:57 -0700 (PDT) Received: from jrouhaud ([210.176.45.84]) by smtp.gmail.com with ESMTPSA id bm8-20020a656e88000000b0041bd0dd79b7sm3633185pgb.90.2022.08.01.02.27.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 01 Aug 2022 02:27:56 -0700 (PDT) Date: Mon, 1 Aug 2022 17:27:53 +0800 From: Julien Rouhaud To: Matthias Apitz Cc: pgsql-general@lists.postgresql.org Subject: Re: a database can be created but not droped Message-ID: <20220801092753.mdynsqehkyfhdvx2@jrouhaud> References: <20220801092233.GA9@sh4-5.1blu.de> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20220801092233.GA9@sh4-5.1blu.de> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk 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;