Re: pg_restore depending on user functions - Mailing list pgsql-general

From Дмитрий Иванов
Subject Re: pg_restore depending on user functions
Date
Msg-id CAPL5KHpN=pz97X+7vThsSn1V0ag8dSBrhMxjpWr1Z=wwU2BPow@mail.gmail.com
Whole thread Raw
In response to Re: pg_restore depending on user functions  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: pg_restore depending on user functions
List pgsql-general
Thanks for the feedback! 
Is it ok to attach a 5MB data schema or is it not possible? Copy one by one to a letter?
It would be nice if in the end I could rebuild the base without hindrance. Thank you in advance.
Restore Windows 10 PostgreSQL 12.9, compiled by Visual C++ build 1914, 64-bit -> Debian 11 PostgreSQL 14.1 (Debian 14.1-1.pgdg110+1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 10.2.1-6) 10.2.1 20210110, 64-bit

sudo /usr/lib/postgresql/14/bin/pg_dump --file "/home/dismay/uchet/Uchet.backup" --host "server" --port "5999" --username "back" --no-password --verbose --format=c --quote-all-identifiers --blobs  --column-inserts --inserts --create --disable-triggers  --encoding="UTF8" "Uchet"
no error/

Drop base

CREATE DATABASE "Uchet"
    WITH
    OWNER = funcowner
    TEMPLATE = template0
    ENCODING = 'UTF8'
    LC_COLLATE = 'ru_RU.UTF-8'
    LC_CTYPE = 'ru_RU.UTF-8'
    CONNECTION LIMIT = -1;
SET check_function_bodies = false;

sudo /usr/lib/postgresql/14/bin/pg_restore --host "127.0.0.1" --port "5432" --username "back" --no-password --dbname "Uchet" --disable-triggers --format=c --create --verbose "/home/dismay/uchet/Uchet.backup"
error:
"bpd"."class_prop_user_smal_val" error syntax money
"bpd"."class_prop_user_small_val_snapshot"  error syntax money
"bpd"."object error insert column is_inside"
ignored error 26603

visible differences                                                                                     base source                    base receiver
count function 711 649
count views 125 117
count rows bpd.object 25769 0
count rows bpd.class_prop_user_small_val 28295 28182
count rows bpd.class_prop_user_small_val_snapshot 33550 33491

lost views:
"int_class_ext"
"int_doc_category_ext"
"int_doc_file_ext"
"int_doc_link_ext"
"int_object_ext"
"vclass_ext"
"vdocument_ext"
"vobject_general_ext"

lost function:
"class_act_base_ext_allowed_by_id_group"
"class_act_ext_allowed_rl1_by_id_position"
"class_act_ext_by_id"
"class_act_ext_by_id_conception_msk_name"
"class_act_ext_by_id_global_prop"
"class_act_ext_by_id_group"
"class_act_ext_by_id_group_msk_name"
"class_act_ext_by_id_parent"
"class_act_ext_by_id_parent_msk_name"
"class_act_ext_by_id_parent_strict_name"
"class_act_ext_by_msk_global_prop"
"class_act_ext_by_msk_global_prop_from_class"
"class_act_ext_by_msk_global_prop_from_group"
"class_act_real_ext_allowed_by_id_group"
"class_act_real_ext_by_id_group"
"class_snapshot_base_ext_by_id_position"
"class_snapshot_ext_by_id"
"class_snapshot_ext_by_id_class"
"class_snapshot_ext_by_id_parent_snapshot"
"class_snapshot_ext_on_object_by_id_parent_snapshot_parent_pos"
"document_ext_by_id"
"document_ext_by_id_category"
"document_ext_by_id_class_prop"
"document_ext_by_id_conception"
"document_ext_by_id_group"
"document_ext_by_id_object"
"document_ext_by_id_object_prop"
"document_ext_by_id_parent"
"document_ext_by_id_pos_temp"
"document_ext_by_id_pos_temp_prop"
"document_ext_by_id_position"
"document_ext_by_id_position_prop"
"document_ext_by_id_user"
"document_ext_by_msk_name_from_category"
"document_ext_by_msk_name_from_conception"
"int_class_ext_prop_by_id_class_array"
"int_object_ext_prop_by_id_object_array"
"object_carrier_ext_by_object_class_full"
"object_ext_by_id"
"object_ext_by_id_class_act"
"object_ext_by_id_class_full"
"object_ext_by_id_class_id_pos"
"object_ext_by_id_class_root"
"object_ext_by_id_class_snapshot"
"object_ext_by_id_class_snapshot_id_pos"
"object_ext_by_id_group"
"object_ext_by_id_group_root"
"object_ext_by_id_object_carrier"
"object_ext_by_id_position"
"object_ext_by_id_position_full"
"object_ext_by_id_prop_data_type"
"object_ext_by_id_prop_enum"
"object_ext_by_id_prop_enum_val"
"object_ext_by_id_unit_conversion_rule"
"object_ext_by_link_object"
"object_ext_by_msk_global_prop"
"object_ext_by_msk_global_prop_from_pos"
"object_ext_by_name"
"object_ext_by_name_id_pos"
"object_ext_carrier_by_msk_global_prop"
"object_object_prop_by_id_object_carrier_ext"
"object_object_prop_by_id_position_carrier_ext"

пн, 15 нояб. 2021 г. в 05:06, Tom Lane <tgl@sss.pgh.pa.us>:
Дмитрий Иванов <firstdismay@gmail.com> writes:
> вс, 14 нояб. 2021 г. в 23:46, Tom Lane <tgl@sss.pgh.pa.us>:
>> This is not "details", this is an evidence-free assertion.  Please show
>> a concrete example of problematic functions.

> Ok, I'll do it.
> [ example ]

This is pretty far from being a self-contained example; I had to guess
at the definitions of several types that you didn't provide.  Having
done so, though, the set of functions and types seem to dump and restore
just fine.  So I still don't see any problem here.

Possibly worth noting is that pg_dump is careful to include this in
its output script:

SET check_function_bodies = false;

Without that, I can believe that you'd have some trouble restoring
these functions, since pg_dump doesn't know anything about the
cross-references appearing in the function bodies.  But with that,
there don't appear to be any troublesome cross-references here.

                        regards, tom lane

pgsql-general by date:

Previous
From: Francisco Olarte
Date:
Subject: Re: help with a query
Next
From: Tom Lane
Date:
Subject: Re: pg_restore depending on user functions