<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	
	>
<channel>
	<title>
	Comments on: PostgreSQL: Get the data difference between two Tables	</title>
	<atom:link href="https://www.dbrnd.com/2017/12/postgresql-get-the-data-difference-between-two-tables-full-outer-join/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.dbrnd.com/2017/12/postgresql-get-the-data-difference-between-two-tables-full-outer-join/</link>
	<description>BIGData &#124; NoSQL &#124; MSSQL &#124; MySQL &#124; PostgreSQL</description>
	<lastBuildDate>Wed, 05 Jun 2019 15:47:36 +0000</lastBuildDate>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=7.0.4</generator>
	<item>
		<title>
		By: leebert		</title>
		<link>https://www.dbrnd.com/2017/12/postgresql-get-the-data-difference-between-two-tables-full-outer-join/#comment-7284</link>

		<dc:creator><![CDATA[leebert]]></dc:creator>
		<pubDate>Wed, 05 Jun 2019 15:47:36 +0000</pubDate>
		<guid isPermaLink="false">https://www.dbrnd.com/?p=6732#comment-7284</guid>

					<description><![CDATA[Food for thought ... here&#039;s a different way to look for inter-table diffs ..


CREATE INDEX tbl_A_idx0 ON tbl_A (id) ;
CREATE INDEX tbl_A_idx1 ON tbl_A (  ( tbl_A )::text) ;

CREATE INDEX tbl_B_idx0 ON tbl_B (id) ;
CREATE INDEX tbl_B_idx1 ON tbl_B (  ( tbl_B )::text) ;


SELECT 
( tbl_A)::text = ( tbl_B)::text

FROM tbl_A a
JOIN tbl_B b 
	ON a.ID = b.ID
AND ( tbl_A)::text    ( tbl_B)::text  ;



(a more exotic approach, creating a data type ... you have to ensure that tbl_A &#038; tbl_B are both of type tbl_AB_type )

CREATE TYPE tbl_AB_type (  id int, fld1 bigint, fld2 text ) ;
CREATE INDEX tbl_A_idx1 ON tbl_A (  ( tbl_A )::tbl_AB_type  ) ;
CREATE INDEX tbl_B_idx1 ON tbl_B (  ( tbl_B )::tbl_AB_type  ) ;

SELECT 
( tbl_A)::tbl_AB_type  = ( tbl_B)::tbl_AB_type   as _bool
, ( tbl_A) AS _row_A
, ( tbl_B) AS _row_B
INTO TEMP TABLE _tmp_tbl
FROM tbl_A a
JOIN tbl_B b 
	ON a.ID = b.ID
AND ( tbl_A)::tbl_AB_type   ( tbl_B)::tbl_AB_type  ;


SELECT (_row_A).id, (_row_B).fld1 
FROM _tmp_tbl 
WHERE ( _row_A) = (_row_B) ;

... and so on ...]]></description>
			<content:encoded><![CDATA[<p>Food for thought &#8230; here&#8217;s a different way to look for inter-table diffs ..</p>
<p>CREATE INDEX tbl_A_idx0 ON tbl_A (id) ;<br />
CREATE INDEX tbl_A_idx1 ON tbl_A (  ( tbl_A )::text) ;</p>
<p>CREATE INDEX tbl_B_idx0 ON tbl_B (id) ;<br />
CREATE INDEX tbl_B_idx1 ON tbl_B (  ( tbl_B )::text) ;</p>
<p>SELECT<br />
( tbl_A)::text = ( tbl_B)::text</p>
<p>FROM tbl_A a<br />
JOIN tbl_B b<br />
	ON a.ID = b.ID<br />
AND ( tbl_A)::text    ( tbl_B)::text  ;</p>
<p>(a more exotic approach, creating a data type &#8230; you have to ensure that tbl_A &amp; tbl_B are both of type tbl_AB_type )</p>
<p>CREATE TYPE tbl_AB_type (  id int, fld1 bigint, fld2 text ) ;<br />
CREATE INDEX tbl_A_idx1 ON tbl_A (  ( tbl_A )::tbl_AB_type  ) ;<br />
CREATE INDEX tbl_B_idx1 ON tbl_B (  ( tbl_B )::tbl_AB_type  ) ;</p>
<p>SELECT<br />
( tbl_A)::tbl_AB_type  = ( tbl_B)::tbl_AB_type   as _bool<br />
, ( tbl_A) AS _row_A<br />
, ( tbl_B) AS _row_B<br />
INTO TEMP TABLE _tmp_tbl<br />
FROM tbl_A a<br />
JOIN tbl_B b<br />
	ON a.ID = b.ID<br />
AND ( tbl_A)::tbl_AB_type   ( tbl_B)::tbl_AB_type  ;</p>
<p>SELECT (_row_A).id, (_row_B).fld1<br />
FROM _tmp_tbl<br />
WHERE ( _row_A) = (_row_B) ;</p>
<p>&#8230; and so on &#8230;</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Namdev Rathod		</title>
		<link>https://www.dbrnd.com/2017/12/postgresql-get-the-data-difference-between-two-tables-full-outer-join/#comment-7002</link>

		<dc:creator><![CDATA[Namdev Rathod]]></dc:creator>
		<pubDate>Mon, 22 Apr 2019 13:02:56 +0000</pubDate>
		<guid isPermaLink="false">https://www.dbrnd.com/?p=6732#comment-7002</guid>

					<description><![CDATA[Hi,

Thanks for your post. I have one quick question  here.

I want to check difference between two tables from two different database like dev and prod.

and if difference found from dev then update same to prod.
only structure not data.

Please help me with suitable solution and query.]]></description>
			<content:encoded><![CDATA[<p>Hi,</p>
<p>Thanks for your post. I have one quick question  here.</p>
<p>I want to check difference between two tables from two different database like dev and prod.</p>
<p>and if difference found from dev then update same to prod.<br />
only structure not data.</p>
<p>Please help me with suitable solution and query.</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: ikomrad		</title>
		<link>https://www.dbrnd.com/2017/12/postgresql-get-the-data-difference-between-two-tables-full-outer-join/#comment-6852</link>

		<dc:creator><![CDATA[ikomrad]]></dc:creator>
		<pubDate>Fri, 18 Jan 2019 20:09:49 +0000</pubDate>
		<guid isPermaLink="false">https://www.dbrnd.com/?p=6732#comment-6852</guid>

					<description><![CDATA[Is this really the difference between 2 tables? 
Table 1 
a = 1
b =2 
c = 3

Table 2
a = 5
b = 2
c= 3 

If I wanted to write a query that told me that A in Table 1 is not the same value as A in Table 2, how would I got about it?]]></description>
			<content:encoded><![CDATA[<p>Is this really the difference between 2 tables?<br />
Table 1<br />
a = 1<br />
b =2<br />
c = 3</p>
<p>Table 2<br />
a = 5<br />
b = 2<br />
c= 3 </p>
<p>If I wanted to write a query that told me that A in Table 1 is not the same value as A in Table 2, how would I got about it?</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Abhi		</title>
		<link>https://www.dbrnd.com/2017/12/postgresql-get-the-data-difference-between-two-tables-full-outer-join/#comment-6062</link>

		<dc:creator><![CDATA[Abhi]]></dc:creator>
		<pubDate>Sun, 03 Dec 2017 16:26:06 +0000</pubDate>
		<guid isPermaLink="false">https://www.dbrnd.com/?p=6732#comment-6062</guid>

					<description><![CDATA[Can I use left join to do the same thing here?]]></description>
			<content:encoded><![CDATA[<p>Can I use left join to do the same thing here?</p>
]]></content:encoded>
		
			</item>
	</channel>
</rss>
