Search Postgresql Archives

Re: libc to libicu via pg_dump/pg_restore?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.klaver@xxxxxxxxxxx






[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]

  Powered by Linux