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 1tfzw5-006s6N-EY for pgsql-general@arkaria.postgresql.org; Thu, 06 Feb 2025 11:20:45 +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 1tfzw4-006UBB-7S for pgsql-general@arkaria.postgresql.org; Thu, 06 Feb 2025 11:20:44 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1tfzw3-006UB1-SS for pgsql-general@lists.postgresql.org; Thu, 06 Feb 2025 11:20:43 +0000 Received: from mail-wm1-x332.google.com ([2a00:1450:4864:20::332]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1tfzw0-003t14-35 for pgsql-general@lists.postgresql.org; Thu, 06 Feb 2025 11:20:43 +0000 Received: by mail-wm1-x332.google.com with SMTP id 5b1f17b1804b1-438a3216fc2so7660325e9.1 for ; Thu, 06 Feb 2025 03:20:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1738840840; x=1739445640; darn=lists.postgresql.org; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=AT8OSsUQiKf7poIjuiof8rJc7kJdnEs+mt6GPSkCfps=; b=BNo27MvIJbb2b1bTlO7u0iOPBB88ATJv3jOoCkvpZE4l6UhwURX6MFDX+hosC3E3Vt dff1P9dpRsKBOCX+7nQScCV/6hgTlQZzyNZ9+Ry8So0eECVYj4BCaWftcdDUdIRkBEp3 LhyU3Zg7aWQSNfNhh6D1e+EftBMAtiHwNpUTfZ5MAyqH2pobJ3/J0k6Gapcva2FnqMcY dg6LaEUnwpF66DFgxLjXpS9IklFCpsesd6phoDdfp/4vSExQbnitHTrceHrikO1Aydoj p+B1gywjqBIsceXDg3aZGsjXlq9EqstxkSxd0+XJr6PVj94f2t2CrACm8VnPmsAl/q0k qaCA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1738840840; x=1739445640; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=AT8OSsUQiKf7poIjuiof8rJc7kJdnEs+mt6GPSkCfps=; b=WEcdf0lCbiwuWg/uvj5yeSAb+hqtvsRN+EeVsQANyNhVxv2Uq0aqe4ngZZ4inMirOy Wux0Dm8S0SqcfkxcEJh3ErFunamfsPUEvlMGPfEUyb7Rz9bbRwMzUR8ffIMTDzh2+Py/ x+k15s1Gb8zMxTVcz4cDifTcDLY+jUBEO9YsPbsa0pFhHpkHPkzpNPJ2JDa3iqufd7rn LO+h6kRLhPETb6TNndLfM+9z0UFqmCLDXpuo9wQXSPzpF+6XEL1lwW07cVAPswfh9zeC WjFXhP4Rmq99S29BfenXrNCmu67B8h3ybLfF1w+jETJRfzxy44ZEto695/oIy9aJM3Cm d7rA== X-Gm-Message-State: AOJu0YyWwAv5Qneofrf/eRShgwQV6CuW93jl9VhLfiU94Pt24zo5aTZm IAeFrTbVSl8rHogF1N2zIwVREQ1twktPRW5XFgGFKtwGyoUn2zPl X-Gm-Gg: ASbGncu5YxSoHV9Fm62YYtJyjsA7z0/44uwVLDkanoAW3SJ2UyHFr6rmDoq3VG64Fr5 kBBeE+fk+0FrcnxdGjVA5AhmVe+AJpJ7EJGuCQWzWrw1B1UpzzLgOpeQqWP7uVLmfxl60HWDHdy RpYPx5yZbnsakGNSv4SA8/XBthsT/s4oRTHN3ogxKMIqvxnw+6Wkxj78rHuaD0mF6y53qyNlM47 mpCy8nYvWAX+9wpzHGGkb3GdMjdhUyH1U8K/Erxmdbxq/cU+fz84EgS/addGe6yA4zYUYKCmQps Fh3HvzD2TumIdUUemoMiy0YD4yTCZRclPLu33wQ/zGocQ3YologQKVVlIJXUFpXv8g8A X-Google-Smtp-Source: AGHT+IHitfExoe3YRpScCHWv0Rr25OIPi509jbP9VYr4e4U6Qn5Ejheypitc8E9JPSbeVtl9Zfwlxw== X-Received: by 2002:a05:600c:3b24:b0:438:a432:7c44 with SMTP id 5b1f17b1804b1-4390d552634mr44612955e9.21.1738840840070; Thu, 06 Feb 2025 03:20:40 -0800 (PST) Received: from smtpclient.apple (143-45-239-77.dyn.cable.qlnet.ch. [77.239.45.143]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-38dbde31e09sm1477405f8f.99.2025.02.06.03.20.39 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 06 Feb 2025 03:20:39 -0800 (PST) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3826.400.131.1.6\)) Subject: Re: libc to libicu via pg_dump/pg_restore? From: Paul Foerster In-Reply-To: <2256966c-446f-4607-a47d-04b895b0747b@dalibo.com> Date: Thu, 6 Feb 2025 12:20:08 +0100 Cc: pgsql-general@lists.postgresql.org Content-Transfer-Encoding: quoted-printable Message-Id: <7A2A897E-AD8B-47F7-A29F-980D57425AD9@gmail.com> References: <2256966c-446f-4607-a47d-04b895b0747b@dalibo.com> To: Guillaume Lelarge X-Mailer: Apple Mail (2.3826.400.131.1.6) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hi Guillaume, > On 6 Feb 2025, at 11:13, Guillaume Lelarge = wrote: >=20 > You probably don't need --disable-triggers. You should fix errors in = the order they appear. The first one is on the drop of the database: >=20 > ERROR: cannot drop the currently open database >=20 > pg_restore can't drop the database because it's connected to the = database. When you use -c and -C options, you can't connect to the = database you want to restore to. You have to connect to another = database, such as postgres, so that it can do the drop and the create. = After both are done, it will connect to the just-created database to do = the restore step. >=20 > Look at the pg_restore man page = (https://www.postgresql.org/docs/current/app-pgrestore.html). It says on = the --create option: >=20 > When this option is used, the database named with -d is used only to = issue the initial DROP DATABASE and CREATE DATABASE commands. All data = is restored into the database name that appears in the archive. This is intended because the dump contains a create database statement = which creates the database with libc which is exactly what I do NOT = want. I want it to be a libicu database. So I pre-create it as such and = inhibit recreation by pg_restore by sitting on it with a session. So the = first message about the database not being created is expected and can = be ignored. This works fine for all databases so far. My problem is the constraint violation which inhibits the foreign key = contraints from being created. Everything works for all databases. Only this one has that problem. And = since I disabled triggers during restore, that shouldn't be a problem = either. Btw., the parent table contains the rows in question. So they are = imported. I just can't make out why there is a problem. Cheers, Paul=