Re: libc to libicu via pg_dump/pg_restore?

From: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>
To: Paul Foerster <paul(dot)foerster(at)gmail(dot)com>, pgsql-general list <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Re: libc to libicu via pg_dump/pg_restore?
Date: 2025-02-06 16:31:24
Message-ID: 187f2c5d-f268-4596-bb63-c94790ae761d@aklaver.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

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
adrian(dot)klaver(at)aklaver(dot)com

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Adrian Klaver 2025-02-06 17:15:55 Re: How to perform a long running dry run transaction without blocking
Previous Message Adrian Klaver 2025-02-06 16:15:29 Re: How to perform a long running dry run transaction without blocking