<?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>search_path &#8211; Database Research &amp; Development</title>
	<atom:link href="https://www.dbrnd.com/tag/search_path/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>Mon, 02 Apr 2018 19:29:55 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=7.0.6</generator>
	<item>
		<title>PostgreSQL: Best Practice &#8211; Create Extension in Schema</title>
		<link>https://www.dbrnd.com/2017/12/postgresql-best-practice-create-extension-in-schema/</link>
					<comments>https://www.dbrnd.com/2017/12/postgresql-best-practice-create-extension-in-schema/#comments</comments>
		
		<dc:creator><![CDATA[Anvesh Patel]]></dc:creator>
		<pubDate>Thu, 14 Dec 2017 16:16:55 +0000</pubDate>
				<category><![CDATA[PostgreSQL]]></category>
		<category><![CDATA[Anvesh Patel]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[database research and development]]></category>
		<category><![CDATA[dblink]]></category>
		<category><![CDATA[dbrnd]]></category>
		<category><![CDATA[extension]]></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 Monitoring]]></category>
		<category><![CDATA[PostgreSQL Performance Tuning]]></category>
		<category><![CDATA[PostgreSQL Programming]]></category>
		<category><![CDATA[PostgreSQL Tips and Tricks]]></category>
		<category><![CDATA[search_path]]></category>
		<guid isPermaLink="false">https://www.dbrnd.com/?p=6810</guid>

					<description><![CDATA[In this post, I am sharing a best practice of creating any extension in Schema of PostgreSQL. Using Extension, we can add additional functionality in PostgreSQL. If we do not provide any schema specification, it will create under search_path schema which PUBLIC most of the time. PostgreSQL: The Schema Search Path and change the default [&#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%2F2017%2F12%2Fpostgresql-best-practice-create-extension-in-schema%2F&amp;linkname=PostgreSQL%3A%20Best%20Practice%20%E2%80%93%20Create%20Extension%20in%20Schema" 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%2F2017%2F12%2Fpostgresql-best-practice-create-extension-in-schema%2F&amp;linkname=PostgreSQL%3A%20Best%20Practice%20%E2%80%93%20Create%20Extension%20in%20Schema" 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%2F2017%2F12%2Fpostgresql-best-practice-create-extension-in-schema%2F&amp;linkname=PostgreSQL%3A%20Best%20Practice%20%E2%80%93%20Create%20Extension%20in%20Schema" 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%2F2017%2F12%2Fpostgresql-best-practice-create-extension-in-schema%2F&amp;linkname=PostgreSQL%3A%20Best%20Practice%20%E2%80%93%20Create%20Extension%20in%20Schema" 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%2F2017%2F12%2Fpostgresql-best-practice-create-extension-in-schema%2F&amp;linkname=PostgreSQL%3A%20Best%20Practice%20%E2%80%93%20Create%20Extension%20in%20Schema" 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%2F2017%2F12%2Fpostgresql-best-practice-create-extension-in-schema%2F&amp;linkname=PostgreSQL%3A%20Best%20Practice%20%E2%80%93%20Create%20Extension%20in%20Schema" 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%2F2017%2F12%2Fpostgresql-best-practice-create-extension-in-schema%2F&#038;title=PostgreSQL%3A%20Best%20Practice%20%E2%80%93%20Create%20Extension%20in%20Schema" data-a2a-url="https://www.dbrnd.com/2017/12/postgresql-best-practice-create-extension-in-schema/" data-a2a-title="PostgreSQL: Best Practice – Create Extension in Schema"></a></p><p>In this post, I am sharing a best practice of creating any extension in Schema of PostgreSQL.</p>
<p>Using Extension, we can add additional functionality in PostgreSQL.<br />
If we do not provide any schema specification, it will create under search_path schema which PUBLIC most of the time.</p>
<blockquote class="wp-embedded-content" data-secret="l320OB7rS6"><p><a href="https://www.dbrnd.com/2016/08/postgresql-the-schema-search-path-and-change-the-default-public-schema/">PostgreSQL: The Schema Search Path and change the default PUBLIC Schema</a></p></blockquote>
<p><iframe class="wp-embedded-content" sandbox="allow-scripts" security="restricted"  src="https://www.dbrnd.com/2016/08/postgresql-the-schema-search-path-and-change-the-default-public-schema/embed/#?secret=l320OB7rS6" data-secret="l320OB7rS6" width="600" height="338" title="&#8220;PostgreSQL: The Schema Search Path and change the default PUBLIC Schema&#8221; &#8212; Database Research &amp; Development" frameborder="0" marginwidth="0" marginheight="0" scrolling="no"></iframe></p>
<p><strong>Now, why we should create an extension in schema?</strong></p>
<blockquote><p>For example, I created a &#8216;dblink&#8217; extension without schema specification and I am using dblink functions without giving any schema name because it formed in search_path schema. </p>
<p>But, If I create a &#8216;dblink&#8217; extension in dblink schema, we have to access dblink features by specifying the schema name of that extension. This is also good for code and other management as a backup of the schema.</p></blockquote>
<p><strong>Check the below example:</strong></p>
<p><strong>Create a user-defined schema:</strong></p>
<pre class="crayon-plain-tag">CREATE SCHEMA dblink;</pre> </p>
<p><strong>Create a dblink extension, under dblink schema:</strong></p>
<pre class="crayon-plain-tag">CREATE EXTENSION dblink WITH SCHEMA dblink;</pre> </p>
<blockquote class="wp-embedded-content" data-secret="yQ4Cqs0mbq"><p><a href="https://www.dbrnd.com/2015/05/postgresql-cross-database-queries-using/">PostgreSQL [Video]: Cross Database Queries using DbLink Extension</a></p></blockquote>
<p><iframe class="wp-embedded-content" sandbox="allow-scripts" security="restricted"  src="https://www.dbrnd.com/2015/05/postgresql-cross-database-queries-using/embed/#?secret=yQ4Cqs0mbq" data-secret="yQ4Cqs0mbq" width="600" height="338" title="&#8220;PostgreSQL [Video]: Cross Database Queries using DbLink Extension&#8221; &#8212; Database Research &amp; Development" frameborder="0" marginwidth="0" marginheight="0" scrolling="no"></iframe></p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.dbrnd.com/2017/12/postgresql-best-practice-create-extension-in-schema/feed/</wfw:commentRss>
			<slash:comments>2</slash:comments>
		
		
			</item>
		<item>
		<title>PostgreSQL: The Schema Search Path and change the default PUBLIC Schema</title>
		<link>https://www.dbrnd.com/2016/08/postgresql-the-schema-search-path-and-change-the-default-public-schema/</link>
		
		<dc:creator><![CDATA[Anvesh Patel]]></dc:creator>
		<pubDate>Tue, 02 Aug 2016 17:36:45 +0000</pubDate>
				<category><![CDATA[PostgreSQL]]></category>
		<category><![CDATA[Anvesh Patel]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[database research and development]]></category>
		<category><![CDATA[dbrnd]]></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>
		<category><![CDATA[PUBLIC]]></category>
		<category><![CDATA[schema search path]]></category>
		<category><![CDATA[search_path]]></category>
		<guid isPermaLink="false">https://www.dbrnd.com/?p=2249</guid>

					<description><![CDATA[Most of the PostgreSQL Professionals are wondering about that why objects are stored in default public schema when they have not supplied schema identifier. The Schema Search Path of the PostgreSQL: The best practice is to provide a schema identifier for each and every database object, but also this is one of the important topic [&#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-the-schema-search-path-and-change-the-default-public-schema%2F&amp;linkname=PostgreSQL%3A%20The%20Schema%20Search%20Path%20and%20change%20the%20default%20PUBLIC%20Schema" 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-the-schema-search-path-and-change-the-default-public-schema%2F&amp;linkname=PostgreSQL%3A%20The%20Schema%20Search%20Path%20and%20change%20the%20default%20PUBLIC%20Schema" 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-the-schema-search-path-and-change-the-default-public-schema%2F&amp;linkname=PostgreSQL%3A%20The%20Schema%20Search%20Path%20and%20change%20the%20default%20PUBLIC%20Schema" 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-the-schema-search-path-and-change-the-default-public-schema%2F&amp;linkname=PostgreSQL%3A%20The%20Schema%20Search%20Path%20and%20change%20the%20default%20PUBLIC%20Schema" 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-the-schema-search-path-and-change-the-default-public-schema%2F&amp;linkname=PostgreSQL%3A%20The%20Schema%20Search%20Path%20and%20change%20the%20default%20PUBLIC%20Schema" 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-the-schema-search-path-and-change-the-default-public-schema%2F&amp;linkname=PostgreSQL%3A%20The%20Schema%20Search%20Path%20and%20change%20the%20default%20PUBLIC%20Schema" 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-the-schema-search-path-and-change-the-default-public-schema%2F&#038;title=PostgreSQL%3A%20The%20Schema%20Search%20Path%20and%20change%20the%20default%20PUBLIC%20Schema" data-a2a-url="https://www.dbrnd.com/2016/08/postgresql-the-schema-search-path-and-change-the-default-public-schema/" data-a2a-title="PostgreSQL: The Schema Search Path and change the default PUBLIC Schema"></a></p><p><em>Most of the PostgreSQL Professionals are wondering about that why objects are stored in default public schema when they have not supplied schema identifier.</em></p>
<p><strong>The Schema Search Path of the PostgreSQL:</strong></p>
<blockquote><p>The best practice is to provide a schema identifier for each and every database object, but also this is one of the important topic about schema identifier because sometimes specifying an object with the schema identifier is a tedious task. </p></blockquote>
<blockquote><p>The currently default schema search path is PUBLIC schema so whenever we are creating any object with schema identifier, it creates in the default PUBLIC schema. </p></blockquote>
<p><strong>Below is a script to check current search path:</strong></p>
<pre class="crayon-plain-tag">SHOW search_path;

/* Result
search_path
------------------
"$user", public
*/</pre> </p>
<p>For example, I create one table without a schema identifier and see it stored in the default PUBLIC schema. </p>
<pre class="crayon-plain-tag">CREATE TABLE tbl_TestSearchPath
(
	ID INTEGER PRIMARY KEY
	,Name CHARACTER VARYING(50)
);</pre> </p>
<p>Below are two SELECT statements which have no any difference because when we are using the database object without the schema identifier, it fetches from the default PUBLIC schema. </p>
<pre class="crayon-plain-tag">SELECT *FROM tbl_TestSearchPath;
SELECT *FROM public.tbl_TestSearchPath;</pre> </p>
<blockquote><p>If we are dealing with multiple schemas in a single database, I would suggest you to always provide Schema Identifier for each and every database object. </p></blockquote>
<blockquote><p>But when we are dealing with only one schema and if you want to change your default schema search path, you can use below script to change default schema search path. </p></blockquote>
<pre class="crayon-plain-tag">SET search_path TO Schema_Name;</pre> </p>
]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
