GitHub user A-little-bit-of-data added a comment to the discussion: How to 
import postgresql data from 2.1 to 4.1

Hello, I read the unresolved discussion you gave, and it is different from 
mine, so it is not applicable. Then if I use PostgreSQL version 
16.1.0-debian-11-r25, the service can be started, but this is limited to new 
installations. Now I need to update the superset version through helm on 
version 2.1. Then I will get an error if I use it directly. `The data directory 
was initialized by PostgreSQL version 14, which is not compatible with this 
version 16.1`. I have described this before. As for using pg_dump and 
pg_restore, an error will be reported:
`pg_restore: error: could not execute query: ERROR:  constraint 
"tab_state_latest_query_id_fkey" for relation "tab_state" already exists
Command was: ALTER TABLE ONLY public.tab_state
    ADD CONSTRAINT tab_state_latest_query_id_fkey FOREIGN KEY (latest_query_id) 
REFERENCES public.query(client_id) ON DELETE SET NULL;


pg_restore: error: could not execute query: ERROR:  constraint 
"tab_state_user_id_fkey" for relation "tab_state" already exists
Command was: ALTER TABLE ONLY public.tab_state
    ADD CONSTRAINT tab_state_user_id_fkey FOREIGN KEY (user_id) REFERENCES 
public.ab_user(id);


pg_restore: error: could not execute query: ERROR:  constraint 
"table_columns_changed_by_fk_fkey" for relation "table_columns" already exists
Command was: ALTER TABLE ONLY public.table_columns
    ADD CONSTRAINT table_columns_changed_by_fk_fkey FOREIGN KEY (changed_by_fk) 
REFERENCES public.ab_user(id);


pg_restore: error: could not execute query: ERROR:  constraint 
"table_columns_created_by_fk_fkey" for relation "table_columns" already exists
Command was: ALTER TABLE ONLY public.table_columns
    ADD CONSTRAINT table_columns_created_by_fk_fkey FOREIGN KEY (created_by_fk) 
REFERENCES public.ab_user(id);


pg_restore: error: could not execute query: ERROR:  constraint 
"table_schema_changed_by_fk_fkey" for relation "table_schema" already exists
Command was: ALTER TABLE ONLY public.table_schema
    ADD CONSTRAINT table_schema_changed_by_fk_fkey FOREIGN KEY (changed_by_fk) 
REFERENCES public.ab_user(id);


pg_restore: error: could not execute query: ERROR:  constraint 
"table_schema_created_by_fk_fkey" for relation "table_schema" already exists
Command was: ALTER TABLE ONLY public.table_schema
    ADD CONSTRAINT table_schema_created_by_fk_fkey FOREIGN KEY (created_by_fk) 
REFERENCES public.ab_user(id);


pg_restore: error: could not execute query: ERROR:  constraint 
"table_schema_database_id_fkey" for relation "table_schema" already exists
Command was: ALTER TABLE ONLY public.table_schema
    ADD CONSTRAINT table_schema_database_id_fkey FOREIGN KEY (database_id) 
REFERENCES public.dbs(id) ON DELETE CASCADE;


pg_restore: error: could not execute query: ERROR:  constraint 
"table_schema_tab_state_id_fkey" for relation "table_schema" already exists
Command was: ALTER TABLE ONLY public.table_schema
    ADD CONSTRAINT table_schema_tab_state_id_fkey FOREIGN KEY (tab_state_id) 
REFERENCES public.tab_state(id) ON DELETE CASCADE;


pg_restore: error: could not execute query: ERROR:  constraint 
"tables_changed_by_fk_fkey" for relation "tables" already exists
Command was: ALTER TABLE ONLY public.tables
    ADD CONSTRAINT tables_changed_by_fk_fkey FOREIGN KEY (changed_by_fk) 
REFERENCES public.ab_user(id);


pg_restore: error: could not execute query: ERROR:  constraint 
"tables_created_by_fk_fkey" for relation "tables" already exists
Command was: ALTER TABLE ONLY public.tables
    ADD CONSTRAINT tables_created_by_fk_fkey FOREIGN KEY (created_by_fk) 
REFERENCES public.ab_user(id);


pg_restore: error: could not execute query: ERROR:  constraint 
"tables_database_id_fkey" for relation "tables" already exists
Command was: ALTER TABLE ONLY public.tables
    ADD CONSTRAINT tables_database_id_fkey FOREIGN KEY (database_id) REFERENCES 
public.dbs(id);


pg_restore: error: could not execute query: ERROR:  constraint 
"tag_changed_by_fk_fkey" for relation "tag" already exists
Command was: ALTER TABLE ONLY public.tag
    ADD CONSTRAINT tag_changed_by_fk_fkey FOREIGN KEY (changed_by_fk) 
REFERENCES public.ab_user(id);


pg_restore: error: could not execute query: ERROR:  constraint 
"tag_created_by_fk_fkey" for relation "tag" already exists
Command was: ALTER TABLE ONLY public.tag
    ADD CONSTRAINT tag_created_by_fk_fkey FOREIGN KEY (created_by_fk) 
REFERENCES public.ab_user(id);


pg_restore: error: could not execute query: ERROR:  constraint 
"tagged_object_changed_by_fk_fkey" for relation "tagged_object" already exists
Command was: ALTER TABLE ONLY public.tagged_object
    ADD CONSTRAINT tagged_object_changed_by_fk_fkey FOREIGN KEY (changed_by_fk) 
REFERENCES public.ab_user(id);


pg_restore: error: could not execute query: ERROR:  constraint 
"tagged_object_created_by_fk_fkey" for relation "tagged_object" already exists
Command was: ALTER TABLE ONLY public.tagged_object
    ADD CONSTRAINT tagged_object_created_by_fk_fkey FOREIGN KEY (created_by_fk) 
REFERENCES public.ab_user(id);


pg_restore: error: could not execute query: ERROR:  constraint 
"tagged_object_tag_id_fkey" for relation "tagged_object" already exists
Command was: ALTER TABLE ONLY public.tagged_object
    ADD CONSTRAINT tagged_object_tag_id_fkey FOREIGN KEY (tag_id) REFERENCES 
public.tag(id);


pg_restore: error: could not execute query: ERROR:  constraint 
"user_attribute_changed_by_fk_fkey" for relation "user_attribute" already exists
Command was: ALTER TABLE ONLY public.user_attribute
    ADD CONSTRAINT user_attribute_changed_by_fk_fkey FOREIGN KEY 
(changed_by_fk) REFERENCES public.ab_user(id);


pg_restore: error: could not execute query: ERROR:  constraint 
"user_attribute_created_by_fk_fkey" for relation "user_attribute" already exists
Command was: ALTER TABLE ONLY public.user_attribute
    ADD CONSTRAINT user_attribute_created_by_fk_fkey FOREIGN KEY 
(created_by_fk) REFERENCES public.ab_user(id);


pg_restore: error: could not execute query: ERROR:  constraint 
"user_attribute_user_id_fkey" for relation "user_attribute" already exists
Command was: ALTER TABLE ONLY public.user_attribute
    ADD CONSTRAINT user_attribute_user_id_fkey FOREIGN KEY (user_id) REFERENCES 
public.ab_user(id);


pg_restore: error: could not execute query: ERROR:  constraint 
"user_attribute_welcome_dashboard_id_fkey" for relation "user_attribute" 
already exists
Command was: ALTER TABLE ONLY public.user_attribute
    ADD CONSTRAINT user_attribute_welcome_dashboard_id_fkey FOREIGN KEY 
(welcome_dashboard_id) REFERENCES public.dashboards(id);


pg_restore: warning: errors ignored on restore: 264
I have no name!@superse-3o642r-postgresql-0:/$ pg_restore -h 
superse-3o642r-postgresql.yhsjztcphj1-test -U superset -d superset --no-owner 
/tmp/superset_backup.dump --data-only
Password:
pg_restore: error: COPY failed for table "ab_permission": ERROR:  duplicate key 
value violates unique constraint "ab_permission_pkey"
DETAIL:  Key (id)=(1) already exists.
CONTEXT:  COPY ab_permission, line 1
pg_restore: error: COPY failed for table "ab_permission_view": ERROR:  
duplicate key value violates unique constraint "ab_permission_view_pkey"
DETAIL:  Key (id)=(1) already exists.
CONTEXT:  COPY ab_permission_view, line 1
pg_restore: error: COPY failed for table "ab_permission_view_role": ERROR:  
duplicate key value violates unique constraint "ab_permission_view_role_pkey"
DETAIL:  Key (id)=(1) already exists.
CONTEXT:  COPY ab_permission_view_role, line 1
pg_restore: error: COPY failed for table "ab_role": ERROR:  duplicate key value 
violates unique constraint "ab_role_pkey"
DETAIL:  Key (id)=(1) already exists.
CONTEXT:  COPY ab_role, line 1
pg_restore: error: COPY failed for table "ab_user": ERROR:  duplicate key value 
violates unique constraint "ab_user_pkey"
DETAIL:  Key (id)=(1) already exists.
CONTEXT:  COPY ab_user, line 32
pg_restore: error: COPY failed for table "ab_user_role": ERROR:  duplicate key 
value violates unique constraint "ab_user_role_pkey"
DETAIL:  Key (id)=(1) already exists.
CONTEXT:  COPY ab_user_role, line 1
pg_restore: error: COPY failed for table "ab_view_menu": ERROR:  duplicate key 
value violates unique constraint "ab_view_menu_pkey"
DETAIL:  Key (id)=(1) already exists.
CONTEXT:  COPY ab_view_menu, line 1
pg_restore: error: COPY failed for table "alembic_version": ERROR:  duplicate 
key value violates unique constraint "alembic_version_pkc"
DETAIL:  Key (version_num)=(f3c2d8ec8595) already exists.
CONTEXT:  COPY alembic_version, line 1
pg_restore: error: COPY failed for table "dbs": ERROR:  duplicate key value 
violates unique constraint "dbs_pkey"
DETAIL:  Key (id)=(24) already exists.
CONTEXT:  COPY dbs, line 1
pg_restore: error: COPY failed for table "key_value": ERROR:  duplicate key 
value violates unique constraint "key_value_pkey"
DETAIL:  Key (id)=(2) already exists.
CONTEXT:  COPY key_value, line 1
pg_restore: error: COPY failed for table "logs": ERROR:  insert or update on 
table "logs" violates foreign key constraint "logs_user_id_fkey"
DETAIL:  Key (user_id)=(26) is not present in table "ab_user".
pg_restore: error: COPY failed for table "query": ERROR:  insert or update on 
table "query" violates foreign key constraint "query_user_id_fkey"
DETAIL:  Key (user_id)=(14) is not present in table "ab_user".
pg_restore: error: COPY failed for table "saved_query": ERROR:  duplicate key 
value violates unique constraint "saved_query_pkey"
DETAIL:  Key (id)=(1) already exists.
CONTEXT:  COPY saved_query, line 1
pg_restore: error: COPY failed for table "tab_state": ERROR:  insert or update 
on table "tab_state" violates foreign key constraint 
"tab_state_latest_query_id_fkey"
DETAIL:  Key (latest_query_id)=(WawkjBJbwZO) is not present in table "query".
pg_restore: warning: errors ignored on restore: 14`

GitHub link: 
https://github.com/apache/superset/discussions/33039#discussioncomment-12765621

----
This is an automatically sent email for [email protected].
To unsubscribe, please send an email to: 
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to