agora inbox for pgsql-sql@postgresql.org
help / color / mirror / Atom feedFrom: Kamal Kumar TRR <kamalkumar.trr@gmail.com>
To: pgsql-sql@postgresql.org
Subject: Re: How to compare two tables in PostgreSQL
Date: Mon, 15 Sep 2014 03:43:51 -0700 (PDT)
Message-ID: <1410777831983-5819036.post@n5.nabble.com> (raw)
In-Reply-To: <A76B25F2823E954C9E45E32FA49D70EC08EEEC02@mail.corp.perceptron.com>
References: <CA+MnYCqoDRAQRzJQ2pi4jbZkyDdHtpszc4JH+hFT2TkaE86bxQ@mail.gmail.com>
<A76B25F2823E954C9E45E32FA49D70EC08EEEC02@mail.corp.perceptron.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-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.ht...
Sent from the PostgreSQL - sql mailing list archive at Nabble.com.
--
Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-sql
view thread (9+ messages)
Message-ID: <1410777831983-5819036.post@n5.nabble.com>
Permalink: ../1410777831983-5819036.post@n5.nabble.com/
Also on: postgresql.org/message-id/1410777831983-5819036.post@n5.nabble.com
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: kamalkumar.trr@gmail.com
Subject: Re: How to compare two tables in PostgreSQL
In-Reply-To: <1410777831983-5819036.post@n5.nabble.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox