<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>overwrite &#8211; Database Research &amp; Development</title>
	<atom:link href="https://www.dbrnd.com/tag/overwrite/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.dbrnd.com</link>
	<description>BIGData &#124; NoSQL &#124; MSSQL &#124; MySQL &#124; PostgreSQL</description>
	<lastBuildDate>Sat, 13 Aug 2016 18:13:43 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=7.0.4</generator>
	<item>
		<title>PostgreSQL 9.5: How to Concatenate and Overwrite JSON Document</title>
		<link>https://www.dbrnd.com/2016/08/postgresql-9-5-how-to-concatenate-and-overwrite-json-document-json-jsonb-data-type-operator/</link>
		
		<dc:creator><![CDATA[Anvesh Patel]]></dc:creator>
		<pubDate>Sat, 13 Aug 2016 18:13:43 +0000</pubDate>
				<category><![CDATA[PostgreSQL]]></category>
		<category><![CDATA[Anvesh Patel]]></category>
		<category><![CDATA[CONCAT]]></category>
		<category><![CDATA[data type]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[database research and development]]></category>
		<category><![CDATA[dbrnd]]></category>
		<category><![CDATA[JSON]]></category>
		<category><![CDATA[jsonb]]></category>
		<category><![CDATA[overwrite]]></category>
		<category><![CDATA[plpgsql]]></category>
		<category><![CDATA[Postgres Query]]></category>
		<category><![CDATA[postgresql]]></category>
		<category><![CDATA[PostgreSQL Administrator]]></category>
		<category><![CDATA[PostgreSQL Error]]></category>
		<category><![CDATA[PostgreSQL Programming]]></category>
		<category><![CDATA[PostgreSQL Tips and Tricks]]></category>
		<guid isPermaLink="false">https://www.dbrnd.com/?p=3443</guid>

					<description><![CDATA[The PostgreSQL JSON data type is also one of the my favorite topic. I have written multiple article on PostgreSQL JSON data type. PostgreSQL 9.4: The JSON data type is Awesome (Part 1/3) PostgreSQL 9.5 introduced one new operator (&#124;&#124;) which used to perform Concatenate and Overwrite of JSON Document. The requirement is something like: [&#8230;]]]></description>
										<content:encoded><![CDATA[<p><a class="a2a_button_facebook" href="https://www.addtoany.com/add_to/facebook?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F08%2Fpostgresql-9-5-how-to-concatenate-and-overwrite-json-document-json-jsonb-data-type-operator%2F&amp;linkname=PostgreSQL%209.5%3A%20How%20to%20Concatenate%20and%20Overwrite%20JSON%20Document" title="Facebook" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_twitter" href="https://www.addtoany.com/add_to/twitter?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F08%2Fpostgresql-9-5-how-to-concatenate-and-overwrite-json-document-json-jsonb-data-type-operator%2F&amp;linkname=PostgreSQL%209.5%3A%20How%20to%20Concatenate%20and%20Overwrite%20JSON%20Document" title="Twitter" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_linkedin" href="https://www.addtoany.com/add_to/linkedin?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F08%2Fpostgresql-9-5-how-to-concatenate-and-overwrite-json-document-json-jsonb-data-type-operator%2F&amp;linkname=PostgreSQL%209.5%3A%20How%20to%20Concatenate%20and%20Overwrite%20JSON%20Document" title="LinkedIn" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_pinterest" href="https://www.addtoany.com/add_to/pinterest?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F08%2Fpostgresql-9-5-how-to-concatenate-and-overwrite-json-document-json-jsonb-data-type-operator%2F&amp;linkname=PostgreSQL%209.5%3A%20How%20to%20Concatenate%20and%20Overwrite%20JSON%20Document" title="Pinterest" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_reddit" href="https://www.addtoany.com/add_to/reddit?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F08%2Fpostgresql-9-5-how-to-concatenate-and-overwrite-json-document-json-jsonb-data-type-operator%2F&amp;linkname=PostgreSQL%209.5%3A%20How%20to%20Concatenate%20and%20Overwrite%20JSON%20Document" title="Reddit" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_pocket" href="https://www.addtoany.com/add_to/pocket?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F08%2Fpostgresql-9-5-how-to-concatenate-and-overwrite-json-document-json-jsonb-data-type-operator%2F&amp;linkname=PostgreSQL%209.5%3A%20How%20to%20Concatenate%20and%20Overwrite%20JSON%20Document" title="Pocket" rel="nofollow noopener" target="_blank"></a><a class="a2a_dd addtoany_share_save addtoany_share" href="https://www.addtoany.com/share#url=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F08%2Fpostgresql-9-5-how-to-concatenate-and-overwrite-json-document-json-jsonb-data-type-operator%2F&#038;title=PostgreSQL%209.5%3A%20How%20to%20Concatenate%20and%20Overwrite%20JSON%20Document" data-a2a-url="https://www.dbrnd.com/2016/08/postgresql-9-5-how-to-concatenate-and-overwrite-json-document-json-jsonb-data-type-operator/" data-a2a-title="PostgreSQL 9.5: How to Concatenate and Overwrite JSON Document"></a></p><p>The PostgreSQL JSON data type is also one of the my favorite topic.<br />
I have written multiple article on PostgreSQL JSON data type. </p>
<blockquote class="wp-embedded-content" data-secret="VwMBqIgKFg"><p><a href="https://www.dbrnd.com/2016/02/postgresql-9-4-the-json-data-type-is-awesome-part-1/">PostgreSQL 9.4: The JSON data type is Awesome (Part 1/3)</a></p></blockquote>
<p><iframe class="wp-embedded-content" sandbox="allow-scripts" security="restricted"  src="https://www.dbrnd.com/2016/02/postgresql-9-4-the-json-data-type-is-awesome-part-1/embed/#?secret=VwMBqIgKFg" data-secret="VwMBqIgKFg" width="600" height="338" title="&#8220;PostgreSQL 9.4: The JSON data type is Awesome (Part 1/3)&#8221; &#8212; Database Research &amp; Development" frameborder="0" marginwidth="0" marginheight="0" scrolling="no"></iframe></p>
<p><strong>PostgreSQL 9.5 introduced one new operator (||) which used to perform Concatenate and Overwrite of JSON Document.</strong></p>
<blockquote><p>The requirement is something like: we have stored one JSON string or document into PostgreSQL. Now we require to add any new key or elements into that document. </p></blockquote>
<blockquote><p>It was not possible in the previous version of PostgreSQL, but now we can use (||) this operator to add or overwrite particular key into the JSON document. </p></blockquote>
<p><strong>Please go through this full practical demonstration:</strong></p>
<p><strong>Create a table with Sample data:</strong></p>
<pre class="crayon-plain-tag">CREATE TABLE tbl_TestJSON
(
	ID INTEGER PRIMARY KEY
	,DepartName VARCHAR(250)
	,EmployeeDetails JSONB
	,Address JSONB
);

INSERT INTO tbl_TestJSON
VALUES 
(
	1
	,'Sales'
	,'
	{"employees":[
	    {"firstName":"Anvesh", "lastName":"Patel"},
	    {"firstName":"Eric", "lastName":"Marin"},
	    {"firstName":"Martin", "lastName":"Loother"}
	]}'
	,'{"address" : "Hyderabad"}'
)
,(
	2
	,'Production'
	,'
	{"employees":[
	    {"firstName":"Neevan", "lastName":"Patel"},
	    {"firstName":"Roy", "lastName":"Boon"},
	    {"firstName":"Nancy", "lastName":"Shah"}
	]}'
	,'{"address" : "Ahmedabad"}'
);</pre> </p>
<p><strong>Using (||) operator can concat two JSON String:</strong><br />
In the below example, you can see &#8220;address&#8221; key is merged with &#8220;employees&#8221; key.</p>
<pre class="crayon-plain-tag">SELECT EmployeeDetails || Address AS JsonData FROM tbl_TestJSON;
/*
		   JsonData
------------------------------------------------
{"address": "Hyderabad"
 ,"employees": 
	[{"lastName": "Patel", "firstName": "Anvesh"}
	,{"lastName": "Marin", "firstName": "Eric"}
	,{"lastName": "Loother", "firstName": "Martin"}
	]
}
{"address": "Ahmedabad"
 ,"employees": 
	[{"lastName": "Patel", "firstName": "Neevan"}
	,{"lastName": "Boon", "firstName": "Roy"}
	,{"lastName": "Shah", "firstName": "Nancy"}
	]
}*/</pre> </p>
<p><strong>Using (||) operator can overwrite the JSON string:</strong><br />
In the below example, you can see the replacement of &#8220;address&#8221; value. </p>
<pre class="crayon-plain-tag">SELECT EmployeeDetails || Address || '{"address": "Pune"}'FROM tbl_TestJSON;
/*
		  JsonData
-------------------------------------------------
{"address": "Pune"
 ,"employees": 
	    [{"lastName": "Patel", "firstName": "Anvesh"}
	    ,{"lastName": "Marin", "firstName": "Eric"}
	    ,{"lastName": "Loother", "firstName": "Martin"}
	    ]
}
{"address": "Pune"
 ,"employees": 
	   [{"lastName": "Patel", "firstName": "Neevan"}
	   ,{"lastName": "Boon", "firstName": "Roy"}
	   ,{"lastName": "Shah", "firstName": "Nancy"}
	   ]
}*/</pre> </p>
]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
