public inbox for [email protected]  
help / color / mirror / Atom feed
From: Adrian Klaver <[email protected]>
To: Paul Foerster <[email protected]>
To: pgsql-general list <[email protected]>
Subject: Re: libc to libicu via pg_dump/pg_restore?
Date: Thu, 6 Feb 2025 08:31:24 -0800
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>
References: <[email protected]>

On 2/6/25 01:04, Paul Foerster wrote:
> Hi,
> 

Comments inline.

> I have a problem which I don't understand. I have and do:
> 
> 
> instance a, libc based, PostgreSQL 15.10:
> 
> mydb=# \l mydb
>                                                            List of databases
>   Name |  Owner  | Encoding |   Collate   |    Ctype    | ICU Locale | Locale Provider | Access privileges
> ------+---------+----------+-------------+-------------+------------+-----------------+-------------------
>   mydb | my_user | UTF8     | en_US.UTF-8 | en_US.UTF-8 |            | libc            |
> 
> $ pg_dump -Fc -Z1 -b mydb -f mydb.dump.gz
> $ ls -l mydb.dump.gz
> -rw------- 1 postgres postgres 14660308577 Feb  6 08:45 mydb.dump.gz
> 
> 
> instance b, libicu based, PostgreSQL 17.2:
> $ psql postgres
> 
> # create database mydb;
> # \l mydb
>                                                                List of databases
>   Name |   Owner  | Encoding | Locale Provider |   Collate   |    Ctype    | Locale | ICU Rules | Access privileges
> ------+----------+----------+-----------------+-------------+-------------+--------+-----------+-------------------
>   mydb | postgres | UTF8     | icu             | en_US.UTF-8 | en_US.UTF-8 | en-US  |           |
> 
> $ pg_restore -cC --if-exists --disable-triggers -d mydb mydb.dump.gz

I would start by doing:

1) Log into postgres database and do:

  a) DROP DATABASE mydb;
  b) CREATE DATABASE mydb <options>;

2) pg_restore -d mydb mydb.dump.gz


> pg_restore: error: could not execute query: ERROR:  insert or update on table "table_1" violates foreign key constraint "..._fk"
> DETAIL:  Key (dokument_id)=(1000033680) is not present in table "...".

Is dokument_id an integer field?

> Command was: ALTER TABLE ONLY myschema.table
>     ADD CONSTRAINT table_fk FOREIGN KEY (dokument_id) REFERENCES myschema.dokument(id);
> 
> 
> pg_restore: error: could not execute query: ERROR:  insert or update on table "table_2" violates foreign key constraint "..._fk"
> DETAIL:  Key (dokument_id)=(1000033740) is not present in table "dokument".
> Command was: ALTER TABLE ONLY vostra2_str.nen_dokument
>     ADD CONSTRAINT table_fk FOREIGN KEY (dokument_id) REFERENCES myschema.dokument(id);
> 
> 

> 
> What am I doing wrong or how can I better achieve that? Any help would be appreciated.

In a follow post you said:

"Everything works for all databases. Only this one has that problem."

Do you mean you made the same libc --> icu change on the other databases 
with no errors?

> 
> Thanks in advance.
> 
> Paul
> 

-- 
Adrian Klaver
[email protected]







view thread (3+ messages)  latest in thread

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected], [email protected]
  Subject: Re: libc to libicu via pg_dump/pg_restore?
  In-Reply-To: <[email protected]>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox