Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sJa4U-005hev-Al for pgsql-general@arkaria.postgresql.org; Tue, 18 Jun 2024 14:44:30 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1sJa4S-00Eb0T-6I for pgsql-general@arkaria.postgresql.org; Tue, 18 Jun 2024 14:44:29 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sJa4R-00Eb0L-BT for pgsql-general@lists.postgresql.org; Tue, 18 Jun 2024 14:44:28 +0000 Received: from fhigh8-smtp.messagingengine.com ([103.168.172.159]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sJa4P-001vMb-3j for pgsql-general@lists.postgresql.org; Tue, 18 Jun 2024 14:44:26 +0000 Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailfhigh.nyi.internal (Postfix) with ESMTP id 5017411400E0; Tue, 18 Jun 2024 10:44:24 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute5.internal (MEProxy); Tue, 18 Jun 2024 10:44:24 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aklaver.com; h= cc:content-transfer-encoding:content-type:content-type:date:date :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to; s=fm1; t=1718721864; x=1718808264; bh=SznEzl6B+dNz95otbLvz2ZC6qiGv7LzSB6P1ctJfehU=; b= qXVmSBm4Lz1D1dwREI/EjLS5VjI4sGh+kbRtY9WpXNg22RjjSNHXv2w9bxEagePl nDA5s45OkHgkioTJccJT/DfnjzpanOBAtKMkpUbJ8lc2qnnM7P8ROtLMWfU4wZus y2qaIjS1elJFKodPK00WwQfvjuDhuxdeo/LUXYrT4WEQHA6dL3SpBlZ3lOXxg4TJ LFDT2oUP2GvzRl2sHRvzk7G+5NQpjaCOsPMt8omstLaLW3mtls7SuoD5Jlp/jQAZ d8HsqBVY7qMVY+aNdGzZPQcfF2ST9Bwwm0WOt1E1ZCOL3pLODY23DjkK5ntCuy2g Tp9JgdlsLxNsTyTabf4PSg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm2; t=1718721864; x= 1718808264; bh=SznEzl6B+dNz95otbLvz2ZC6qiGv7LzSB6P1ctJfehU=; b=q PnB2p52aiiMkQn/QeGIOlRKrBRyGKqiiDuo+8swvcZpBf7G7z9Yd0kIhmZaWTdW8 nMsNgj9+mz/88VOjVUxhijumNyCwi5CjTLUuKrfL2zWFYv1TX33TAnwRRggxeV1A d/oGdcqg/BGwPBJO140bSVRkcPuEbdX/ooyWVXc+MKarfRGvoin86Y6AgLI0OhNY 78c02NvInjdpPfD7133U5gBHZ1i5M+B7dPUtUnNzCjHerUEvpAuVF2B7Jgbm6YUd PbowmioyW5RGlhcY5NRORfMOFAcSowpQPymRWBRlj3eKiPTU01WJZMo9BEFaVxS6 xbwWejfhVG7QC1kUUqLIA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvledrfedvkedgheduucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepkfffgggfuffvfhfhjggtgfesthekredttddvjeenucfhrhhomheptegurhhi rghnucfmlhgrvhgvrhcuoegrughrihgrnhdrkhhlrghvvghrsegrkhhlrghvvghrrdgtoh hmqeenucggtffrrghtthgvrhhnpeelgeevkeekkeeuiefgtdevieeluefhfedufeetkeej ffekjeeujeehgeehgeektdenucffohhmrghinhepphhoshhtghhrvghsqhhlrdhorhhgne cuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomheprggurhhi rghnrdhklhgrvhgvrhesrghklhgrvhgvrhdrtghomh X-ME-Proxy: Feedback-ID: i76984098:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 18 Jun 2024 10:44:23 -0400 (EDT) Message-ID: <30eb1a5a-794c-4ee6-b305-9bdaaa9e56ff@aklaver.com> Date: Tue, 18 Jun 2024 07:44:23 -0700 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: DROP COLLATION vs pg_collation question To: Karsten Hilbert , pgsql-general@lists.postgresql.org References: <26f717988471c4d672cce8c495a2c8e68446486a.camel@cybertec.at> <56da532b44bc02a7648796041ffa5da0a85c06df.camel@cybertec.at> <740fb9086af71f864ddb526cad1e55888385bedd.camel@cybertec.at> <3031360.1718570329@sss.pgh.pa.us> Content-Language: en-US From: Adrian Klaver In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 6/18/24 06:32, Karsten Hilbert wrote: > Am Tue, Jun 18, 2024 at 03:02:56PM +0200 schrieb Karsten Hilbert: > >> I see, and since any database can be used as a template for >> more databases, which can be create with an encoding >> different from the template, > > Proving myself wrong: > > > root@hermes:~/tmp# sudo -u postgres psql -e -f /tmp/db.sql > Output format is wrapped. > drop database if exists new_tmpl; > DROP DATABASE > create database new_tmpl with encoding = 'utf8'; > CREATE DATABASE > You are now connected to database "new_tmpl" as user "postgres". > select current_database(); > current_database > ------------------ > new_tmpl > (1 row) > > drop database if exists new_latin1; > psql:/tmp/db.sql:8: HINWEIS: Datenbank »new_latin1« existiert nicht, wird übersprungen > DROP DATABASE > create database new_latin1 with template = new_tmpl encoding = 'latin1' locale = 'de_DE@latin1'; > psql:/tmp/db.sql:9: FEHLER: neue Kodierung (LATIN1) ist inkompatibel mit der Kodierung der Template-Datenbank (UTF8) > TIP: Verwenden Sie die gleiche Kodierung wie die Template-Datenbank oder verwenden Sie template0 als Template. That is covered here: https://www.postgresql.org/docs/16/manage-ag-templatedbs.html "Another common reason for copying template0 instead of template1 is that new encoding and locale settings can be specified when copying template0, whereas a copy of template1 must use the same settings it does. This is because template1 might contain encoding-specific or locale-specific data, while template0 is known not to." Substitute for template1 and you can get the error you received. > > Karsten > -- > GPG 40BE 5B0E C98E 1713 AFA6 5BC0 3BEA AC80 7D4F C89B > > -- Adrian Klaver adrian.klaver@aklaver.com