Check if two tables have the same structure (are compatible)
Having example schema like:

create table table1 (
  id integer,
  txt text,
  col1 integer,
  col2 integer);

create table table2 (
  id integer,
  txt text,
  col1 text,
  colx integer);


and assuming you don't care about column names you can check potential conflicts in union-ed columns with query:

(select data_type, ordinal_position 
from information_schema.columns 
where table_name = 'table1'
except
select data_type, ordinal_position 
from information_schema.columns 
where table_name = 'table2')
union all
(select data_type, ordinal_position 
from information_schema.columns 
where table_name = 'table2'
except
select data_type, ordinal_position 
from information_schema.columns 
where table_name = 'table1'
)
order by 2;


The result will show offending column's position in tables' structure and data type.

data_type   ordinal_position
integer     3
text    3


If you have this shortened list you can check details in information_schema.columns disctionary to check details about each column.