Re: libc to libicu via pg_dump/pg_restore? - Mailing list pgsql-general

From Paul Foerster
Subject Re: libc to libicu via pg_dump/pg_restore?
Date
Msg-id 7A2A897E-AD8B-47F7-A29F-980D57425AD9@gmail.com
Whole thread Raw
In response to libc to libicu via pg_dump/pg_restore?  (Paul Foerster <paul.foerster@gmail.com>)
Responses Re: libc to libicu via pg_dump/pg_restore?
List pgsql-general
Hi Guillaume,

> On 6 Feb 2025, at 11:13, Guillaume Lelarge <guillaume.lelarge@dalibo.com> wrote:
>
> You probably don't need --disable-triggers. You should fix errors in the order they appear. The first one is on the
dropof the database: 
>
> ERROR:  cannot drop the currently open database
>
> pg_restore can't drop the database because it's connected to the database. When you use -c and -C options, you can't
connectto the database you want to restore to. You have to connect to another database, such as postgres, so that it
cando the drop and the create. After both are done, it will connect to the just-created database to do the restore
step.
>
> Look at the pg_restore man page (https://www.postgresql.org/docs/current/app-pgrestore.html). It says on the --create
option:
>
> When this option is used, the database named with -d is used only to issue the initial DROP DATABASE and CREATE
DATABASEcommands. 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
exactlywhat I do NOT want. I want it to be a libicu database. So I pre-create it as such and inhibit recreation by
pg_restoreby sitting on it with a session. So the first message about the database not being created is expected and
canbe 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'tbe 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


pgsql-general by date:

Previous
From: Paul Foerster
Date:
Subject: libc to libicu via pg_dump/pg_restore?
Next
From: Guillaume Lelarge
Date:
Subject: Re: libc to libicu via pg_dump/pg_restore?