<?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>Randell&#039;s Blog &#187; PostgreSQL</title>
	<atom:link href="http://blog.randell.ph/tag/postgresql/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.randell.ph</link>
	<description>Software development, Fedora how-to&#039;s, and random stuff from the web</description>
	<lastBuildDate>Thu, 14 Mar 2013 15:32:44 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5.1</generator>
		<item>
		<title>Power Architect</title>
		<link>http://blog.randell.ph/2010/06/01/power-architect/</link>
		<comments>http://blog.randell.ph/2010/06/01/power-architect/#comments</comments>
		<pubDate>Tue, 01 Jun 2010 02:00:31 +0000</pubDate>
		<dc:creator>Randell</dc:creator>
				<category><![CDATA[Resources]]></category>
		<category><![CDATA[Software Development]]></category>
		<category><![CDATA[Tools]]></category>
		<category><![CDATA[Data Modeling Tool]]></category>
		<category><![CDATA[DB2]]></category>
		<category><![CDATA[ETL]]></category>
		<category><![CDATA[Kettle ETL]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[Oracle]]></category>
		<category><![CDATA[PostgreSQL]]></category>
		<category><![CDATA[Power Architect]]></category>
		<category><![CDATA[SQL Server]]></category>

		<guid isPermaLink="false">http://randell.ph/geeky/?p=702</guid>
		<description><![CDATA[In my search for a data modeling tool that is similar to MySQL Workbench, but works for PostgreSQL databases, I found out about Power Architect. What is Power Architect? Power Architect is a cross-platform, open-source visual data modeling and profiling tool with a GUI and an embeddable API designed for data architects, DBAs, analysts, and [...]<div class='yarpp-related-rss'>

Related posts:<ol>
<li><a href='http://blog.randell.ph/2009/08/06/ultimate-power/' rel='bookmark' title='Ultimate power'>Ultimate power</a></li>
<li><a href='http://blog.randell.ph/2010/05/17/pg_restore-tar-archiver-could-not-find-header-for-file-in-tar-archive/' rel='bookmark' title='pg_restore: [tar archiver] could not find header for file in tar archive'>pg_restore: [tar archiver] could not find header for file in tar archive</a></li>
<li><a href='http://blog.randell.ph/2009/08/27/postgresql-restore-and-dump/' rel='bookmark' title='PostgreSQL restore and dump'>PostgreSQL restore and dump</a></li>
<li><a href='http://blog.randell.ph/2009/07/26/install-sqlite-database-browser-on-fedora/' rel='bookmark' title='Install SQLite Database Browser on Fedora'>Install SQLite Database Browser on Fedora</a></li>
<li><a href='http://blog.randell.ph/2011/07/13/how-to-add-power-off-option-in-gnome-3-user-menu-on-fedora-15/' rel='bookmark' title='How to add Power Off option in Gnome 3 User Menu on Fedora 15'>How to add Power Off option in Gnome 3 User Menu on Fedora 15</a></li>
</ol>
</div>
]]></description>
				<content:encoded><![CDATA[<p>In my search for a data modeling tool that is similar to MySQL Workbench, but works for PostgreSQL databases, I found out about Power Architect.</p>
<p><strong>What is Power Architect?</strong></p>
<p>Power Architect is a cross-platform, open-source visual data modeling and profiling tool with a GUI and an embeddable API designed for data architects, DBAs, analysts, and designers.</p>
<p><strong>What does Power Architect allow you to do?</strong></p>
<ul>
<li>Maintain a single database schema that works well with multiple database platforms</li>
<li>Open multiple database sources concurrently</li>
<li>Drag and drop objects (schemas, tables, columns) into the data modeling playpen to create new models</li>
<li>Forward engineer data models into new databases on different platforms (Oracle, SQL Server, DB2, PostgreSQL, MySQL)</li>
<li>Create ETL (Extract, Transform , Load) to use with Kettle ETL to populate the new database</li>
<li>View and compare data structures and mappings of any two databases</li>
<li>Generate required DDL statements to synchronize databases</li>
<li>Create easy-to-read profile summarizing the data contained in the database</li>
</ul>
<p>You can download Power Architect from the <a title="SQL Power Group" href="http://www.sqlpower.ca/page/tryarchitect" target="_blank">SQL Power Group website</a> or from its <a title="Google Code Project Hosting" href="http://code.google.com/p/power-architect/downloads/list" target="_blank">Google Code Project Hosting page</a>. I chose the latter since downloading it from the SQL Power Group site requires logging in.</p>
<p>You can run the generic distribution from the command line with the following command:</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="bash" style="font-family:monospace;">java <span style="color: #660033;">-jar</span> <span style="color: #007800;">$ARCHITECT_HOME</span><span style="color: #000000; font-weight: bold;">/</span>architect.jar</pre></td></tr></table></div>

<p>where $ARCHITECT_HOME is the directory where your downloaded architect.jar is located. For large databases, the default memory size limit of 64MB may not be enough. To extend the limit, use the following command which sets the minimum and maximum heap size for your process:</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="bash" style="font-family:monospace;">java <span style="color: #660033;">-Xms512m</span> <span style="color: #660033;">-Xmx1024m</span> <span style="color: #660033;">-jar</span> architect.jar</pre></td></tr></table></div>

<p><em>Note: You&#8217;ll need the JDBC driver for PostgreSQL to make it work.</em></p>
<p>Power Architect works for Windows, Mac, and Linux. And the best thing about it &#8211; it&#8217;s free!</p>
<p>Here are a couple of demos that will show you just how awesome this tool is:</p>
<p><strong>Forward/Reverse Engineering with SQL Power Architect</strong></p>
<p><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="480" height="385" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="src" value="http://www.youtube.com/v/QY486ucLWMc&amp;hl=en_US&amp;fs=1&amp;" /><param name="allowfullscreen" value="true" /><embed type="application/x-shockwave-flash" width="480" height="385" src="http://www.youtube.com/v/QY486ucLWMc&amp;hl=en_US&amp;fs=1&amp;" allowfullscreen="true"></embed></object></p>
<p><strong>Data Modeling using SQL Power Architect</strong></p>
<p><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="480" height="385" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="src" value="http://www.youtube.com/v/hHBSMGr6yDg&amp;hl=en_US&amp;fs=1&amp;" /><param name="allowfullscreen" value="true" /><embed type="application/x-shockwave-flash" width="480" height="385" src="http://www.youtube.com/v/hHBSMGr6yDg&amp;hl=en_US&amp;fs=1&amp;" allowfullscreen="true"></embed></object></p>
<p><strong>Data Profiling using SQL Power Architect</strong></p>
<p><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="480" height="385" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="src" value="http://www.youtube.com/v/tRH3p9LN2Ig&amp;hl=en_US&amp;fs=1&amp;" /><param name="allowfullscreen" value="true" /><embed type="application/x-shockwave-flash" width="480" height="385" src="http://www.youtube.com/v/tRH3p9LN2Ig&amp;hl=en_US&amp;fs=1&amp;" allowfullscreen="true"></embed></object></p>
<div class='yarpp-related-rss'>
<p>Related posts:<ol>
<li><a href='http://blog.randell.ph/2009/08/06/ultimate-power/' rel='bookmark' title='Ultimate power'>Ultimate power</a></li>
<li><a href='http://blog.randell.ph/2010/05/17/pg_restore-tar-archiver-could-not-find-header-for-file-in-tar-archive/' rel='bookmark' title='pg_restore: [tar archiver] could not find header for file in tar archive'>pg_restore: [tar archiver] could not find header for file in tar archive</a></li>
<li><a href='http://blog.randell.ph/2009/08/27/postgresql-restore-and-dump/' rel='bookmark' title='PostgreSQL restore and dump'>PostgreSQL restore and dump</a></li>
<li><a href='http://blog.randell.ph/2009/07/26/install-sqlite-database-browser-on-fedora/' rel='bookmark' title='Install SQLite Database Browser on Fedora'>Install SQLite Database Browser on Fedora</a></li>
<li><a href='http://blog.randell.ph/2011/07/13/how-to-add-power-off-option-in-gnome-3-user-menu-on-fedora-15/' rel='bookmark' title='How to add Power Off option in Gnome 3 User Menu on Fedora 15'>How to add Power Off option in Gnome 3 User Menu on Fedora 15</a></li>
</ol></p>
</div>
]]></content:encoded>
			<wfw:commentRss>http://blog.randell.ph/2010/06/01/power-architect/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>pg_restore: [tar archiver] could not find header for file in tar archive</title>
		<link>http://blog.randell.ph/2010/05/17/pg_restore-tar-archiver-could-not-find-header-for-file-in-tar-archive/</link>
		<comments>http://blog.randell.ph/2010/05/17/pg_restore-tar-archiver-could-not-find-header-for-file-in-tar-archive/#comments</comments>
		<pubDate>Mon, 17 May 2010 02:00:42 +0000</pubDate>
		<dc:creator>Randell</dc:creator>
				<category><![CDATA[Resources]]></category>
		<category><![CDATA[Software Development]]></category>
		<category><![CDATA[pg_dump]]></category>
		<category><![CDATA[PostgreSQL]]></category>
		<category><![CDATA[tar]]></category>

		<guid isPermaLink="false">http://blog.randell.ph/?p=1296</guid>
		<description><![CDATA[From my old notes, I posted the way I create PostgreSQL dumps.  It turns out that when you&#8217;re trying to dump a huge database (20+GB), the dump would continue and finish, but pg_restore-ing it will not work flawlessly as expected and might show an error message like this one: pg_restore: [tar archiver] could not find [...]<div class='yarpp-related-rss'>

Related posts:<ol>
<li><a href='http://blog.randell.ph/2009/08/27/postgresql-restore-and-dump/' rel='bookmark' title='PostgreSQL restore and dump'>PostgreSQL restore and dump</a></li>
<li><a href='http://blog.randell.ph/2010/06/01/power-architect/' rel='bookmark' title='Power Architect'>Power Architect</a></li>
</ol>
</div>
]]></description>
				<content:encoded><![CDATA[<p>From <a title="PostgreSQL restore and dump" href="http://blog.randell.ph/2009/08/27/postgresql-restore-and-dump/" target="_blank">my old notes</a>, I posted the way I create PostgreSQL dumps.  It turns out that when you&#8217;re trying to dump a huge database (20+GB), the dump would continue and finish, but <code>pg_restore</code>-ing it will not work flawlessly as expected and might show an error message like this one:</p>
<pre>pg_restore: [tar archiver] could not find header for file 2110.dat in tar archive</pre>
<p>One possible solution is to use <code>-Fc</code> instead of <code>-Ft</code>.  From the man pages, <code>-c</code> means <code>custom</code>:</p>
<blockquote><p>Output  a  custom  archive  suitable   for   input   into pg_restore.  This  is the most flexible format in that it allows reordering of loading data as well as object definitions. This format is also compressed by default.</p></blockquote>
<p>and <code>-t</code> means <code>tar</code>:</p>
<blockquote><p>Output  a tar archive suitable for input into pg_restore. Using this archive format allows reordering and/or exclusion  of  database objects  at  the time the database is restored. It is also possible  to  limit  which  data  is reloaded at restore time.</p></blockquote>
<p>Based on those definitions, I didn&#8217;t have a clue that restoring dumps created using the tar format would fail during restoration. I had to spend extra hours just to create a new dump and download it from a remote server.</p>
<p>Maybe I missed some important details from <a title="PostgreSQL: Documentation" href="http://www.postgresql.org/docs/8.0/static/app-pgdump.html" target="_blank">the documentation</a> because after reading it again, I found this:</p>
<blockquote><p>Members of tar archives are limited to a size less than 8 GB. (This is an inherent limitation of the tar file format.) Therefore this format cannot be used if the textual representation of any one table exceeds that size. The total size of a tar archive and any of the other output formats is not limited, except possibly by the operating system.</p></blockquote>
<p>If all else fails, read the manual.</p>
<div class='yarpp-related-rss'>
<p>Related posts:<ol>
<li><a href='http://blog.randell.ph/2009/08/27/postgresql-restore-and-dump/' rel='bookmark' title='PostgreSQL restore and dump'>PostgreSQL restore and dump</a></li>
<li><a href='http://blog.randell.ph/2010/06/01/power-architect/' rel='bookmark' title='Power Architect'>Power Architect</a></li>
</ol></p>
</div>
]]></content:encoded>
			<wfw:commentRss>http://blog.randell.ph/2010/05/17/pg_restore-tar-archiver-could-not-find-header-for-file-in-tar-archive/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PostgreSQL notes</title>
		<link>http://blog.randell.ph/2009/11/13/postgresql-notes/</link>
		<comments>http://blog.randell.ph/2009/11/13/postgresql-notes/#comments</comments>
		<pubDate>Fri, 13 Nov 2009 09:20:49 +0000</pubDate>
		<dc:creator>Randell</dc:creator>
				<category><![CDATA[Software Development]]></category>
		<category><![CDATA[PostgreSQL]]></category>

		<guid isPermaLink="false">http://randell.ph/geeky/?p=863</guid>
		<description><![CDATA[This is just another one of my notes. I often encounter these errors after a fresh install of Fedora. After executing psql -U postgres and getting this message: psql: could not connect to server: No such file or directory Is the server running locally and accepting connections on Unix domain socket &#8220;/tmp/.s.PGSQL.5432&#8243;? It could mean [...]<div class='yarpp-related-rss'>

Related posts:<ol>
<li><a href='http://blog.randell.ph/2009/08/27/postgresql-restore-and-dump/' rel='bookmark' title='PostgreSQL restore and dump'>PostgreSQL restore and dump</a></li>
<li><a href='http://blog.randell.ph/2010/04/01/thoughts-and-notes-on-unit-testing/' rel='bookmark' title='Thoughts and notes on unit testing'>Thoughts and notes on unit testing</a></li>
<li><a href='http://blog.randell.ph/2010/05/17/pg_restore-tar-archiver-could-not-find-header-for-file-in-tar-archive/' rel='bookmark' title='pg_restore: [tar archiver] could not find header for file in tar archive'>pg_restore: [tar archiver] could not find header for file in tar archive</a></li>
</ol>
</div>
]]></description>
				<content:encoded><![CDATA[<p>This is just another one of my notes.  I often encounter these errors after a fresh install of Fedora.</p>
<p>After executing</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="bash" style="font-family:monospace;">psql <span style="color: #660033;">-U</span> postgres</pre></td></tr></table></div>

<p>and getting this message:</p>
<blockquote><p>psql: could not connect to server: No such file or directory<br />
Is the server running locally and accepting<br />
connections on Unix domain socket &#8220;/tmp/.s.PGSQL.5432&#8243;?</p></blockquote>
<p><span id="more-863"></span><br />
It could mean that the postgresql service has not been started (and it could also mean some other things that I haven&#8217;t encountered yet).  So to start the database, execute the following commands as root:</p>
<p><strong>Initialize the database</strong></p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="bash" style="font-family:monospace;">service postgresql initdb</pre></td></tr></table></div>

<p><strong>Start the PostgreSQL service</strong></p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>init.d<span style="color: #000000; font-weight: bold;">/</span>postgresql start</pre></td></tr></table></div>

<p>Then, if I get this message:</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="bash" style="font-family:monospace;">psql: FATAL:  Ident authentication failed <span style="color: #000000; font-weight: bold;">for</span> user <span style="color: #ff0000;">&quot;postgres&quot;</span></pre></td></tr></table></div>

<p>it means I need to edit the last few lines of <code>/var/lib/pgsql/data/pg_hba.conf</code> (<em>this file controls: which hosts are allowed to connect, how clients are authenticated, which PostgreSQL user names they can use, which databases they can access)</em> to look like this:</p>
<pre># TYPE  DATABASE    USER        CIDR-ADDRESS          METHOD

# "local" is for Unix domain socket connections only
local   all         all                               trust
# IPv4 local connections:
host    all         all         127.0.0.1/32          ident sameuser
# IPv6 local connections:
host    all         all         ::1/128               ident sameuser</pre>
<p>The change is with the line containing the <code>local</code> connection type, whose method is changed from <code>ident</code> to <code>trust</code></p>
<p>Then restart the PostgreSQL service:</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>init.d<span style="color: #000000; font-weight: bold;">/</span>postgresql restart</pre></td></tr></table></div>

<div class='yarpp-related-rss'>
<p>Related posts:<ol>
<li><a href='http://blog.randell.ph/2009/08/27/postgresql-restore-and-dump/' rel='bookmark' title='PostgreSQL restore and dump'>PostgreSQL restore and dump</a></li>
<li><a href='http://blog.randell.ph/2010/04/01/thoughts-and-notes-on-unit-testing/' rel='bookmark' title='Thoughts and notes on unit testing'>Thoughts and notes on unit testing</a></li>
<li><a href='http://blog.randell.ph/2010/05/17/pg_restore-tar-archiver-could-not-find-header-for-file-in-tar-archive/' rel='bookmark' title='pg_restore: [tar archiver] could not find header for file in tar archive'>pg_restore: [tar archiver] could not find header for file in tar archive</a></li>
</ol></p>
</div>
]]></content:encoded>
			<wfw:commentRss>http://blog.randell.ph/2009/11/13/postgresql-notes/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PostgreSQL restore and dump</title>
		<link>http://blog.randell.ph/2009/08/27/postgresql-restore-and-dump/</link>
		<comments>http://blog.randell.ph/2009/08/27/postgresql-restore-and-dump/#comments</comments>
		<pubDate>Thu, 27 Aug 2009 09:35:43 +0000</pubDate>
		<dc:creator>Randell</dc:creator>
				<category><![CDATA[Software Development]]></category>
		<category><![CDATA[dump]]></category>
		<category><![CDATA[PostgreSQL]]></category>
		<category><![CDATA[restore]]></category>

		<guid isPermaLink="false">http://randell.ph/geeky/?p=768</guid>
		<description><![CDATA[This is just a note to myself.  This is how I create backup and restore backup of postgresql databases right now: pg_dump -U postgres -F t -b -v -f &#34;.backup&#34; &#34;&#34; -F : --format=format Selects the format of the output. t : Output a tar archive suitable for input into pg_restore. Using this archive format [...]<div class='yarpp-related-rss'>

Related posts:<ol>
<li><a href='http://blog.randell.ph/2010/05/17/pg_restore-tar-archiver-could-not-find-header-for-file-in-tar-archive/' rel='bookmark' title='pg_restore: [tar archiver] could not find header for file in tar archive'>pg_restore: [tar archiver] could not find header for file in tar archive</a></li>
<li><a href='http://blog.randell.ph/2009/11/13/postgresql-notes/' rel='bookmark' title='PostgreSQL notes'>PostgreSQL notes</a></li>
</ol>
</div>
]]></description>
				<content:encoded><![CDATA[<p>This is just a note to myself.  This is how I create backup and restore backup of postgresql databases right now:</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="bash" style="font-family:monospace;">pg_dump <span style="color: #660033;">-U</span> postgres <span style="color: #660033;">-F</span> t <span style="color: #660033;">-b</span> <span style="color: #660033;">-v</span> <span style="color: #660033;">-f</span> <span style="color: #ff0000;">&quot;.backup&quot;</span> <span style="color: #ff0000;">&quot;&quot;</span></pre></td></tr></table></div>

<ul>
<li><code>-F</code> : <tt>--format=<tt><em>format</em></tt></tt> Selects the format of the output.</li>
<li><code>t</code> : Output a <tt>tar</tt> archive suitable for input into           <span>pg_restore</span>. Using this archive format allows reordering and/or exclusion of database objects at the time the database is restored. It is also possible to limit which data is reloaded at restore time.</li>
<li><code>-b</code> :  <tt>--blobs </tt>Include large objects in the dump.  A non-text output format         must be selected.</li>
<li><code>-v</code> : Specifies verbose mode.  This will cause         <span>pg_dump</span> to output detailed object comments and start/stop times to the dump file, and progress messages to standard error.</li>
</ul>
<ul>
<li>-f : <tt>--file=<tt><em>file </em></tt></tt>Send output to the specified file.  If this is omitted, the         standard output is used.</li>
</ul>

<div class="wp_syntax"><table><tr><td class="code"><pre class="bash" style="font-family:monospace;">pg_restore <span style="color: #660033;">-U</span> postgres <span style="color: #660033;">-d</span>  .backup</pre></td></tr></table></div>

<p>If there are better ways to do this, feel free to leave a comment.  Thanks!</p>
<div class='yarpp-related-rss'>
<p>Related posts:<ol>
<li><a href='http://blog.randell.ph/2010/05/17/pg_restore-tar-archiver-could-not-find-header-for-file-in-tar-archive/' rel='bookmark' title='pg_restore: [tar archiver] could not find header for file in tar archive'>pg_restore: [tar archiver] could not find header for file in tar archive</a></li>
<li><a href='http://blog.randell.ph/2009/11/13/postgresql-notes/' rel='bookmark' title='PostgreSQL notes'>PostgreSQL notes</a></li>
</ol></p>
</div>
]]></content:encoded>
			<wfw:commentRss>http://blog.randell.ph/2009/08/27/postgresql-restore-and-dump/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
