Re: How to compare two tables in PostgreSQL - Mailing list pgsql-sql

From Kamal Kumar TRR
Subject Re: How to compare two tables in PostgreSQL
Date
Msg-id 1410777831983-5819036.post@n5.nabble.com
Whole thread Raw
In response to Re: How to compare two tables in PostgreSQL  (Igor Neyman <ineyman@perceptron.com>)
List pgsql-sql
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.



pgsql-sql by date:

Previous
From: Dev Kumkar
Date:
Subject: Re: [GENERAL] pg_multixact issues
Next
From: Weiss, Jörg
Date:
Subject: FOREIGN KEY Reference on multiple columns