I have a database (postgresql) with 10 schema and every schema has 10 tables. For some reasons, some tables do not have a primary key.
Is it possible to create a function/trigger that can look for all tables and
- add a column
id_pk serial(if the column does not exist) - and make it a primary key (if the table has not any primary key)?