Specify primary key or replica identity for tables without

To identify the tables without primary key and add the replication identity to full, as required for the logical replication, I used in my tests on staging the following command:

select 'ALTER TABLE '||tab.table_schema||'.'||tab.table_name||' REPLICA IDENTITY FULL ;'
from information_schema.tables tab
left join information_schema.table_constraints tco 
          on tab.table_schema = tco.table_schema
          and tab.table_name = tco.table_name 
          and tco.constraint_type = 'PRIMARY KEY'
where tab.table_type = 'BASE TABLE'
      and tab.table_schema not in ('pg_catalog', 'information_schema')
      and tco.constraint_name is null
order by tab.table_name;

the output was:

 ALTER TABLE public.analytics_language_trend_repository_languages REPLICA IDENTITY FULL ;
 ALTER TABLE public.approval_project_rules_protected_branches REPLICA IDENTITY FULL ;
 ALTER TABLE public.ci_build_trace_sections REPLICA IDENTITY FULL ;
 ALTER TABLE public.deployment_merge_requests REPLICA IDENTITY FULL ;
 ALTER TABLE public.elasticsearch_indexed_namespaces REPLICA IDENTITY FULL ;
 ALTER TABLE public.elasticsearch_indexed_projects REPLICA IDENTITY FULL ;
 ALTER TABLE public.issue_assignees REPLICA IDENTITY FULL ;
 ALTER TABLE public.issues_prometheus_alert_events REPLICA IDENTITY FULL ;
 ALTER TABLE public.issues_self_managed_prometheus_alert_events REPLICA IDENTITY FULL ;
 ALTER TABLE public.merge_request_context_commit_diff_files REPLICA IDENTITY FULL ;
 ALTER TABLE public.merge_request_diff_commits REPLICA IDENTITY FULL ;
 ALTER TABLE public.merge_request_diff_files REPLICA IDENTITY FULL ;
 ALTER TABLE public.milestone_releases REPLICA IDENTITY FULL ;
 ALTER TABLE public.my_table REPLICA IDENTITY FULL ;
 ALTER TABLE public.pg_stat_statements_history REPLICA IDENTITY FULL ;
 ALTER TABLE public.project_authorizations REPLICA IDENTITY FULL ;
 ALTER TABLE public.project_pages_metadata REPLICA IDENTITY FULL ;
 ALTER TABLE public.push_event_payloads REPLICA IDENTITY FULL ;
 ALTER TABLE public.repository_languages REPLICA IDENTITY FULL ;
 ALTER TABLE public.schema_migrations REPLICA IDENTITY FULL ;
 ALTER TABLE public.truncate_test REPLICA IDENTITY FULL ;
 ALTER TABLE public.user_interacted_projects REPLICA IDENTITY FULL ;
 ALTER TABLE public.users_security_dashboard_projects REPLICA IDENTITY FULL ;
(23 rows)

The goal is for the future to create a database migration to enable this change in all the environments.

How should we proceed?

My main concern is if we add the replica identity full now, we could miss some new table without PK that we could create before we use logical replication in prod.

I will defer to @abrandl for the most suitable approach.

Edited by Andreas Brandl