NOTE: SIMILAR TABLES -- Ignore if it doesn't meet your requirement.
If you like to compare the structure of the similar tables, then prefer
below example which will help you in locating the missing/additional column.
Consider we have these two tables on different schema.
Table: 1 : billing_name
columns: no, name, invid, amount
Table 2: billing_name
columns: no,name,invid
*select * from (select column_name from information_schema.columns where
table_schema = 'TEST' and table_name like 'billing_name')
WHERE column_name NOT IN
(select column_name from information_schema.columns where table_schema =
'public' and table_name like 'billing_name');*
*Result Set: amount*
Then, you can use any function/SP to dynamically pick the datatype and alter
column on run time.
Thank you for your time.
Kamal
--
View this message in context:
http://postgresql.1045698.n5.nabble.com/How-to-compare-two-tables-in-PostgreSQL-tp5731597p5819036.html
Sent from the PostgreSQL - sql mailing list archive at Nabble.com.