Re: How to compare two tables in PostgreSQL

Поиск
Список
Период
Сортировка
От Kamal Kumar TRR
Тема Re: How to compare two tables in PostgreSQL
Дата
Msg-id 1410777831983-5819036.post@n5.nabble.com
обсуждение исходный текст
Ответ на Re: How to compare two tables in PostgreSQL  (Igor Neyman <ineyman@perceptron.com>)
Список 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 по дате отправления:

Предыдущее
От: Dev Kumkar
Дата:
Сообщение: Re: [GENERAL] pg_multixact issues
Следующее
От: Weiss, Jörg
Дата:
Сообщение: FOREIGN KEY Reference on multiple columns