Загрузка данных


select
    table_schema,
    table_name,
    string_agg(
        column_name,
        ', ' order by ordinal_position
    ) as link_columns
from information_schema.columns
where table_schema in ('ourpension', 'back_office')
    and table_name ilike '%payment%'
    and column_name in (
        'sharer_id',
        'individual_id',
        'contract_id',
        'payment_id',
        'npo_payment_id',
        'payment_decision_id',
        'npo_payment_decision_id',
        'ops_payment_decision_id',
        'operation_id',
        'payment_register_id'
    )
group by table_schema, table_name
order by table_schema, table_name;