<?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>evardsson.com: stuff that w0rks &#187; PostgresQL</title>
	<atom:link href="http://www.evardsson.com/blog/tag/postgresql/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.evardsson.com/blog</link>
	<description>tweaks and hacks, php, python, music, home and ???</description>
	<lastBuildDate>Thu, 29 Jul 2010 19:25:27 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>New Project: SPDO</title>
		<link>http://www.evardsson.com/blog/2009/01/28/new-project-spdo/</link>
		<comments>http://www.evardsson.com/blog/2009/01/28/new-project-spdo/#comments</comments>
		<pubDate>Thu, 29 Jan 2009 02:00:40 +0000</pubDate>
		<dc:creator>Sjan Evardsson</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[Open Source]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[PostgresQL]]></category>
		<category><![CDATA[Projects]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[SPDO]]></category>
		<category><![CDATA[sqlite]]></category>

		<guid isPermaLink="false">http://www.evardsson.com/blog/?p=284</guid>
		<description><![CDATA[I have just posted the (embarrassingly empty) page for my new pet project: SPDO (Sjan&#8217;s PDO) &#8211; in two flavors: PHP and Python. There are only about a thousand PDOs out there, and perhaps a dozen or so of them are really functional and (in a few cases) very polished pieces of work. So why [...]]]></description>
			<content:encoded><![CDATA[<p>I have just posted the (embarrassingly empty) page for my new pet project: SPDO (Sjan&#8217;s PDO) &#8211; in two flavors: <a href="http://www.php.net">PHP</a> and <a href="http://python.org/">Python</a>.</p>
<p>There are only about a thousand PDOs out there, and perhaps a dozen or so of them are really functional and (in a few cases) very polished pieces of work. So why am I messing with writing my own? A couple of reasons:</p>
<ol>
<li>I like to have coding signatures that are consistent, whether I am working with <a href="http://www.postgresql.org/">PostgreSQL</a>, <a href="http://www.mysql.com/">MySQL</a> or (heaven help us all) <a href="http://www.sqlite.org/">SQLite</a>.</li>
<li>I like to have coding signatures that are (reasonably) consistent across different languages &#8211; in this case Python and PHP.</li>
<li>I wanted to take advantage of Prepared Statements where I could, even though the PHP implementations of those are pretty weak (especially in the case of MySQL).</li>
</ol>
<p>Currently implemented in</p>
<ul>
<li>Python:
<ul>
<li>PostgreSQL (with prepared statements)</li>
<li>SQLite (no prepared statements).</li>
</ul>
</li>
<li>PHP
<ul>
<li>PostgreSQL (with prepared statements)</li>
<li>MySQL (with prepared statements)</li>
<li>SQLite (no prepared statements)</li>
</ul>
</li>
</ul>
<p>Here&#8217;s an example of how they work (in most simplistic terms):</p>
<div class="synthi_code" style="display:none;" id ="plain_synthi_4c8aefc88e039">
<div class="synthi_header" style="font-weight:bold;"> Python <span  class="synthi_button"style="font-weight:lighter;font-size:smaller;">[<a href="#" onClick="javascript:document.getElementById('styled_synthi_4c8aefc88e039').style.display='block';document.getElementById('plain_synthi_4c8aefc88e039').style.display='none';return false">Show Styled Code</a>]:</span></div>
<pre style="width:100%;overflow:auto;">
#in Python
from pyDB import *
db = pyDB('mysite')
newid = db.insert('INSERT INTO test (name, value) VALUES (?,?)',['foo','bar'])
update_count = db.update('UPDATE test SET value=? WHERE id=?',['baz',newid])
results = db.select('SELECT * FROM test')
for row in results:
    for i in row:
        print &#034;\t&#034;, i,&#034;\t&#034;, row[i]
delete_count = db.delete('DELETE FROM test WHERE id=?',[newid])
</pre>
</div>
<div class="synthi_code" style="display:block;" id ="styled_synthi_4c8aefc88e039">
<div class="synthi_header" style="font-weight:bold;"> Python <span  class="synthi_button"style="font-weight:lighter;font-size:smaller;">[<a href="#" onClick="javascript:document.getElementById('plain_synthi_4c8aefc88e039').style.display='block';document.getElementById('styled_synthi_4c8aefc88e039').style.display='none';return false">Show Plain Code</a>]:</span></div>
<div class="python" style="font-family: monospace;">
<ol>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 1.2em;"><span style="color: #808080; font-style: italic;">#in Python</span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 1.2em;"><span style="color: #ff7700;font-weight:bold;">from</span> pyDB <span style="color: #ff7700;font-weight:bold;">import</span> *</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 1.2em;">db = pyDB<span style="color: black;">&#40;</span><span style="color: #483d8b;">&#8216;mysite&#8217;</span><span style="color: black;">&#41;</span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 1.2em;">newid = db.<span style="color: black;">insert</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">&#8216;INSERT INTO test (name, value) VALUES (?,?)&#8217;</span>,<span style="color: black;">&#91;</span><span style="color: #483d8b;">&#8216;foo&#8217;</span>,<span style="color: #483d8b;">&#8216;bar&#8217;</span><span style="color: black;">&#93;</span><span style="color: black;">&#41;</span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 1.2em;">update_count = db.<span style="color: black;">update</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">&#8216;UPDATE test SET value=? WHERE id=?&#8217;</span>,<span style="color: black;">&#91;</span><span style="color: #483d8b;">&#8216;baz&#8217;</span>,newid<span style="color: black;">&#93;</span><span style="color: black;">&#41;</span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 1.2em;">results = db.<span style="color: #dc143c;">select</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">&#8216;SELECT * FROM test&#8217;</span><span style="color: black;">&#41;</span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 1.2em;"><span style="color: #ff7700;font-weight:bold;">for</span> row <span style="color: #ff7700;font-weight:bold;">in</span> results:</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 1.2em;">&nbsp; &nbsp; <span style="color: #ff7700;font-weight:bold;">for</span> i <span style="color: #ff7700;font-weight:bold;">in</span> row:</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 1.2em;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff7700;font-weight:bold;">print</span> <span style="color: #483d8b;">&quot;<span style="color: #000099; font-weight: bold;">\t</span>&quot;</span>, i,<span style="color: #483d8b;">&quot;<span style="color: #000099; font-weight: bold;">\t</span>&quot;</span>, row<span style="color: black;">&#91;</span>i<span style="color: black;">&#93;</span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 1.2em;">delete_count = db.<span style="color: black;">delete</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">&#8216;DELETE FROM test WHERE id=?&#8217;</span>,<span style="color: black;">&#91;</span>newid<span style="color: black;">&#93;</span><span style="color: black;">&#41;</span> </div>
</li>
</ol>
</div>
</div>
<div class="synthi_code" style="display:none;" id ="plain_synthi_4c8aefc8974fd">
<div class="synthi_header" style="font-weight:bold;"> PHP <span  class="synthi_button"style="font-weight:lighter;font-size:smaller;">[<a href="#" onClick="javascript:document.getElementById('styled_synthi_4c8aefc8974fd').style.display='block';document.getElementById('plain_synthi_4c8aefc8974fd').style.display='none';return false">Show Styled Code</a>]:</span></div>
<pre style="width:100%;overflow:auto;">
//in PHP
require_once('phpdb.php');
$db = new phpDB('test');
$newid = $db->insert('INSERT INTO test (name, value) VALUES (?,?)',array('foo','bar'));
$update_count = $db->update('UPDATE test SET value=? WHERE id=?',array('baz',newid));
$results = db->select('SELECT * FROM test');
foreach($results as $row)
{
    foreach ($row as $key=>$val)
    {
        print &#034;\t$key\t$val&#034;;
    }
}
$delete_count = $db->delete('DELETE FROM test WHERE id=?',array($newid));
</pre>
</div>
<div class="synthi_code" style="display:block;" id ="styled_synthi_4c8aefc8974fd">
<div class="synthi_header" style="font-weight:bold;"> PHP <span  class="synthi_button"style="font-weight:lighter;font-size:smaller;">[<a href="#" onClick="javascript:document.getElementById('plain_synthi_4c8aefc8974fd').style.display='block';document.getElementById('styled_synthi_4c8aefc8974fd').style.display='none';return false">Show Plain Code</a>]:</span></div>
<div class="php" style="font-family: monospace;">
<ol>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 1.2em;"><span style="color: #808080; font-style: italic;">//in PHP</span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 1.2em;"><span style="color: #b1b100;">require_once</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&#8216;phpdb.php&#8217;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 1.2em;"><span style="color: #0000ff;">$db</span> = <span style="color: #000000; font-weight: bold;">new</span> phpDB<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&#8216;test&#8217;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 1.2em;"><span style="color: #0000ff;">$newid</span> = <span style="color: #0000ff;">$db</span>-&gt;<span style="color: #006600;">insert</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&#8216;INSERT INTO test (name, value) VALUES (?,?)&#8217;</span>,<a href="http://www.php.net/array"><span style="color: #000066;">array</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&#8216;foo&#8217;</span>,<span style="color: #ff0000;">&#8216;bar&#8217;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 1.2em;"><span style="color: #0000ff;">$update_count</span> = <span style="color: #0000ff;">$db</span>-&gt;<span style="color: #006600;">update</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&#8216;UPDATE test SET value=? WHERE id=?&#8217;</span>,<a href="http://www.php.net/array"><span style="color: #000066;">array</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&#8216;baz&#8217;</span>,newid<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 1.2em;"><span style="color: #0000ff;">$results</span> = db-&gt;<span style="color: #006600;">select</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&#8216;SELECT * FROM test&#8217;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 1.2em;"><span style="color: #b1b100;">foreach</span><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$results</span> <span style="color: #b1b100;">as</span> <span style="color: #0000ff;">$row</span><span style="color: #66cc66;">&#41;</span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 1.2em;"><span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 1.2em;">&nbsp; &nbsp; <span style="color: #b1b100;">foreach</span> <span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$row</span> <span style="color: #b1b100;">as</span> <span style="color: #0000ff;">$key</span>=&gt;<span style="color: #0000ff;">$val</span><span style="color: #66cc66;">&#41;</span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 1.2em;">&nbsp; &nbsp; <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 1.2em;">&nbsp; &nbsp; &nbsp; &nbsp; <a href="http://www.php.net/print"><span style="color: #000066;">print</span></a> <span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\t</span>$key<span style="color: #000099; font-weight: bold;">\t</span>$val&quot;</span>;</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 1.2em;">&nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 1.2em;"><span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 1.2em;"><span style="color: #0000ff;">$delete_count</span> = <span style="color: #0000ff;">$db</span>-&gt;<span style="color: #006600;">delete</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&#8216;DELETE FROM test WHERE id=?&#8217;</span>,<a href="http://www.php.net/array"><span style="color: #000066;">array</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$newid</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>; </div>
</li>
</ol>
</div>
</div>
<p>The page with links to the code is in the list up top, and everything is MIT license. Enjoy.</p>
<p align="left"><a class="tt" href="http://twitter.com/home/?status=New+Project%3A+SPDO+http://dg839.th8.us" title="Post to Twitter"><img class="nothumb" src="http://www.evardsson.com/blog/wp-content/plugins/tweet-this/icons/tt-twitter.png" alt="Post to Twitter" /></a> <a class="tt" href="http://buzz.yahoo.com/submit?submitUrl=http://www.evardsson.com/blog/2009/01/28/new-project-spdo/&amp;submitHeadline=New+Project%3A+SPDO" title="Post to Yahoo Buzz"><img class="nothumb" src="http://www.evardsson.com/blog/wp-content/plugins/tweet-this/icons/tt-buzz.png" alt="Post to Yahoo Buzz" /></a> <a class="tt" href="http://buzz.yahoo.com/submit?submitUrl=http://www.evardsson.com/blog/2009/01/28/new-project-spdo/&amp;submitHeadline=New+Project%3A+SPDO" title="Post to Yahoo Buzz">Buzz This Post</a> <a class="tt" href="http://delicious.com/post?url=http://www.evardsson.com/blog/2009/01/28/new-project-spdo/&amp;title=New+Project%3A+SPDO" title="Post to Delicious"><img class="nothumb" src="http://www.evardsson.com/blog/wp-content/plugins/tweet-this/icons/tt-delicious.png" alt="Post to Delicious" /></a> <a class="tt" href="http://delicious.com/post?url=http://www.evardsson.com/blog/2009/01/28/new-project-spdo/&amp;title=New+Project%3A+SPDO" title="Post to Delicious">Delicious</a> <a class="tt" href="http://digg.com/submit?url=http://www.evardsson.com/blog/2009/01/28/new-project-spdo/&amp;title=New+Project%3A+SPDO" title="Post to Digg"><img class="nothumb" src="http://www.evardsson.com/blog/wp-content/plugins/tweet-this/icons/tt-digg.png" alt="Post to Digg" /></a> <a class="tt" href="http://digg.com/submit?url=http://www.evardsson.com/blog/2009/01/28/new-project-spdo/&amp;title=New+Project%3A+SPDO" title="Post to Digg">Digg This Post</a> <a class="tt" href="http://ping.fm/ref/?method=microblog&amp;title=New+Project%3A+SPDO&amp;link=http://www.evardsson.com/blog/2009/01/28/new-project-spdo/" title="Post to Ping.fm"><img class="nothumb" src="http://www.evardsson.com/blog/wp-content/plugins/tweet-this/icons/tt-ping.png" alt="Post to Ping.fm" /></a> <a class="tt" href="http://ping.fm/ref/?method=microblog&amp;title=New+Project%3A+SPDO&amp;link=http://www.evardsson.com/blog/2009/01/28/new-project-spdo/" title="Post to Ping.fm">Ping This Post</a> <a class="tt" href="http://reddit.com/submit?url=http://www.evardsson.com/blog/2009/01/28/new-project-spdo/&amp;title=New+Project%3A+SPDO" title="Post to Reddit"><img class="nothumb" src="http://www.evardsson.com/blog/wp-content/plugins/tweet-this/icons/tt-reddit.png" alt="Post to Reddit" /></a> <a class="tt" href="http://reddit.com/submit?url=http://www.evardsson.com/blog/2009/01/28/new-project-spdo/&amp;title=New+Project%3A+SPDO" title="Post to Reddit">Reddit</a> <a class="tt" href="http://stumbleupon.com/submit?url=http://www.evardsson.com/blog/2009/01/28/new-project-spdo/&amp;title=New+Project%3A+SPDO" title="Post to StumbleUpon"><img class="nothumb" src="http://www.evardsson.com/blog/wp-content/plugins/tweet-this/icons/tt-su.png" alt="Post to StumbleUpon" /></a> <a class="tt" href="http://stumbleupon.com/submit?url=http://www.evardsson.com/blog/2009/01/28/new-project-spdo/&amp;title=New+Project%3A+SPDO" title="Post to StumbleUpon">Stumble This Post</a></p>]]></content:encoded>
			<wfw:commentRss>http://www.evardsson.com/blog/2009/01/28/new-project-spdo/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>UUID Why and How</title>
		<link>http://www.evardsson.com/blog/2009/01/15/uuid-why-and-how/</link>
		<comments>http://www.evardsson.com/blog/2009/01/15/uuid-why-and-how/#comments</comments>
		<pubDate>Thu, 15 Jan 2009 20:21:49 +0000</pubDate>
		<dc:creator>Sjan Evardsson</dc:creator>
				<category><![CDATA[Database]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[PostgresQL]]></category>
		<category><![CDATA[uuid]]></category>

		<guid isPermaLink="false">http://www.evardsson.com/blog/?p=278</guid>
		<description><![CDATA[Seeing the post from Aaron the other day on generating UUIDs in PHP got me to thinking about UUIDs in general. The Why: So why would we want to use UUIDs? The simple answer is that they are (almost) guaranteed to be a &#8220;Universally Unique&#8221; ID. So what? Every database table has its own row [...]]]></description>
			<content:encoded><![CDATA[<p>Seeing the post from Aaron the other day on <a href="http://www.102degrees.com/blog/2009/01/14/php-and-the-uuid/">generating UUIDs in PHP</a> got me to thinking about UUIDs in general.</p>
<p>The Why:</p>
<p>So why would we want to use UUIDs? The simple answer is that they are (almost) guaranteed to be a &#8220;Universally Unique&#8221; ID. So what? Every database table has its own row ids, why do they need to be unique from other database table row ids? Here&#8217;s an example:</p>
<p>Jo has three stores X, Y and Z. Each store has a local customer database. That database contains the following table structures:</p>
<pre>persons:
  id
  name

phones:
  id
  person_id
  phone_number</pre>
<p>(I didn&#8217;t say the tables were all that useful, but they work for the sake of discussion.)</p>
<p>Jo looks at the tables from all three stores and decides that it might be a good idea to combine them into one master customer database to share with all the stores. Here is where the trouble starts. When we compare the three databases we find that we cannot simply dump the data from any one of the databases into any of the others.</p>
<table border="1">
<tr>
<th>Store X</th>
<th>Store Y</th>
<th>Store Z</th>
</tr>
<tr>
<td valign="top">
<table border="0">
<tr>
<th colspan="3" bgcolor="#CCCC66">persons</th>
</tr>
<tr>
<td>id</td>
<td colspan="2">name</td>
</tr>
<tr>
<td>1</td>
<td colspan="2">Sam Smith</td>
</tr>
<tr>
<td>2</td>
<td colspan="2">Terry Tyler</td>
</tr>
<tr>
<th colspan="3" bgcolor="#CCCC66">phones</th>
</tr>
<tr>
<td>id</td>
<td>person_id</td>
<td>phone_number</td>
</tr>
<tr>
<td>1</td>
<td>1</td>
<td>(555)555-1212</td>
</tr>
<tr>
<td>2</td>
<td>2</td>
<td>(555)555-1234</td>
</tr>
<tr>
<td>3</td>
<td>1</td>
<td>(555)555-4321</td>
</tr>
</table>
</td>
<td valign="top">
<table border="0">
<tr>
<th colspan="3" bgcolor="#CCCC66">persons</th>
</tr>
<tr>
<td>id</td>
<td colspan="2">name</td>
</tr>
<tr>
<td>1</td>
<td colspan="2">Perry Paxson</td>
</tr>
<tr>
<td>2</td>
<td colspan="2">Jeremiah Jones</td>
</tr>
<tr>
<th colspan="3" bgcolor="#CCCC66">phones</th>
</tr>
<tr>
<td>id</td>
<td>person_id</td>
<td>phone_number</td>
</tr>
<tr>
<td>1</td>
<td>1</td>
<td>(555)555-2121</td>
</tr>
<tr>
<td>2</td>
<td>2</td>
<td>(555)555-4412</td>
</tr>
</table>
</td>
<td valign="top">
<table border="0">
<tr>
<th colspan="3" bgcolor="#CCCC66">persons</th>
</tr>
<tr>
<td>id</td>
<td colspan="2">name</td>
</tr>
<tr>
<td>1</td>
<td colspan="2">Edie Ellerts</td>
</tr>
<tr>
<td>2</td>
<td colspan="2">Francis Fenimore</td>
</tr>
<tr>
<th colspan="3" bgcolor="#CCCC66">phones</th>
</tr>
<tr>
<td>id</td>
<td>person_id</td>
<td>phone_number</td>
</tr>
<tr>
<td>1</td>
<td>1</td>
<td>(555)555-3434</td>
</tr>
<tr>
<td>2</td>
<td>2</td>
<td>(555)555-7214</td>
</tr>
<tr>
<td>3</td>
<td>2</td>
<td>(555)555-9951</td>
</tr>
</table>
</td>
</tr>
</table>
<p>While this makes it simple in terms of looking up a customer&#8217;s phone number(s) on a single store, <code>SELECT * FROM persons, phones WHERE phones.person_id = persons.person_id AND persons.name = 'Sam Smith'</code>, it leaves us in a tight spot where it comes to combining the databases. We either have to pull all the data programmatically and retain the references from phones to persons and re-insert the whole mess into a new set of tables, or we need to add another field to define which store database the record comes from and change the primary key from the single value (id) to a multiple-field key (id, store_name). This means, of course, that everywhere we reference these values in our code we need to change the SQL. Not a happy solution.</p>
<p>So what if we change the id field type from an integer to a UUID (which is a char(36))? Now our tables would look like:</p>
<table border="1">
<tr>
<th>Store X</th>
</tr>
<tr>
<td valign="top">
<table border="0">
<tr>
<th colspan="3" bgcolor="#CCCC66">persons</th>
</tr>
<tr>
<td>id</td>
<td colspan="2">name</td>
</tr>
<tr>
<td>7d20cac1-d558-4a5c-98c0-ee332b554b29</td>
<td colspan="2">Sam Smith</td>
</tr>
<tr>
<td>5fae5033-36e0-42f8-bb50-c00449c6cab0</td>
<td colspan="2">Terry Tyler</td>
</tr>
<tr>
<th colspan="3" bgcolor="#CCCC66">phones</th>
</tr>
<tr>
<td>id</td>
<td>person_id</td>
<td>phone_number</td>
</tr>
<tr>
<td>82eec34b-897b-40af-9674-fa08e5537d12</td>
<td>7d20cac1-d558-4a5c-98c0-ee332b554b29</td>
<td>(555)555-1212</td>
</tr>
<tr>
<td>08400e86-9bd0-4713-bf6e-a5b8cd3e7e22</td>
<td>5fae5033-36e0-42f8-bb50-c00449c6cab0</td>
<td>(555)555-1234</td>
</tr>
<tr>
<td>ab64d8d7-0511-4b8e-ab57-9932c3c96b31</td>
<td>7d20cac1-d558-4a5c-98c0-ee332b554b29</td>
<td>(555)555-4321</td>
</tr>
</table>
</td>
</tr>
<tr>
<th>Store Y</th>
</tr>
<tr>
<td valign="top">
<table border="0">
<tr>
<th colspan="3" bgcolor="#CCCC66">persons</th>
</tr>
<tr>
<td>id</td>
<td colspan="2">name</td>
</tr>
<tr>
<td>9ca534e4-2dbd-4dc3-a7b3-98ab8b89fb70</td>
<td colspan="2">Perry Paxson</td>
</tr>
<tr>
<td>4cc10585-b864-45bc-9f20-f9761af82e06</td>
<td colspan="2">Jeremiah Jones</td>
</tr>
<tr>
<th colspan="3" bgcolor="#CCCC66">phones</th>
</tr>
<tr>
<td>id</td>
<td>person_id</td>
<td>phone_number</td>
</tr>
<tr>
<td>85302b40-c12b-4a05-8dbb-500f6f5cb26f</td>
<td>9ca534e4-2dbd-4dc3-a7b3-98ab8b89fb70</td>
<td>(555)555-2121</td>
</tr>
<tr>
<td>106a9524-800c-4e5a-ad4a-6ac9f601b370</td>
<td>4cc10585-b864-45bc-9f20-f9761af82e06</td>
<td>(555)555-4412</td>
</tr>
</table>
</td>
</tr>
<tr>
<th>Store Z</th>
</tr>
<tr>
<td valign="top">
<table border="0">
<tr>
<th colspan="3" bgcolor="#CCCC66">persons</th>
</tr>
<tr>
<td>id</td>
<td colspan="2">name</td>
</tr>
<tr>
<td>4da59fb9-ad00-4a5b-aa00-1bb503fe9c8f</td>
<td colspan="2">Edie Ellerts</td>
</tr>
<tr>
<td>8a39f12c-94c4-4b70-ac70-3cff77be8b01</td>
<td colspan="2">Francis Fenimore</td>
</tr>
<tr>
<th colspan="3" bgcolor="#CCCC66">phones</th>
</tr>
<tr>
<td>id</td>
<td>person_id</td>
<td>phone_number</td>
</tr>
<tr>
<td>47d0c49e-02df-4366-853b-a0502edb1de6</td>
<td>4da59fb9-ad00-4a5b-aa00-1bb503fe9c8f</td>
<td>(555)555-3434</td>
</tr>
<tr>
<td>cb868eca-822f-416a-ac7f-0df12504705f</td>
<td>8a39f12c-94c4-4b70-ac70-3cff77be8b01</td>
<td>(555)555-7214</td>
</tr>
<tr>
<td>e70bea84-66e8-407f-bb6c-b164864d22b1</td>
<td>8a39f12c-94c4-4b70-ac70-3cff77be8b01</td>
<td>(555)555-9951</td>
</tr>
</table>
</td>
</tr>
</table>
<p>We now have referential data that we can safely combine into a single database, and can even dump back into all the store local database copies.</p>
<p>The How:</p>
<p>When I need to generate my own UUIDs I certainly use the exact same code as Aaron, even cribbed from the <a href="http://docs.php.net/manual/nl/function.uniqid.php#69164">exact same source</a>. Of course Python has a UUID module which means you can create a version 1, 3, 4 or 5 UUID quickly and easily. I prefer the version 4 UUIDs myself, since version 1 contains identifiable data about the source, and versions 3 and 5 require other information to generate. (In case you are wondering, there is no version 2).</p>
<p>This is simple enough, but I actually prefer things a little simpler, and when I am using PostgreSQL they do get simpler as I can let the database do the UUID generation. (I am aware of the uuid() function that is built in to MySQL 5, however, that uses version 1 UUIDs which contain system identifiable data. If that is okay with you then by all means feel free to use it.) While there are at least a couple PostgreSQL plugins I have seen for generating UUIDs I actually make use of the CREATE FUNCTION capabilities of PostgreSQL to roll my own. (NOTE: To use this function you must have the PostgreSQL cryptographic libraries installed.)</p>
<p>So first I need to see what I am trying to generate.</p>
<p>From the RFC:</p>
<blockquote><p>
<b>4.4. Algorithms for Creating a UUID from Truly Random or Pseudo-Random Numbers</b></p>
<p>   The version 4 UUID is meant for generating UUIDs from truly-random or<br />
   pseudo-random numbers.</p>
<p>   The algorithm is as follows:</p>
<ul>
<li><span style="background-color:#6699FF">Set the two most significant bits (bits 6 and 7) of the clock_seq_hi_and_reserved to zero and one, respectively.</span></li>
<li><span style="background-color:#66FF00">Set the four most significant bits (bits 12 through 15) of the time_hi_and_version field to the 4-bit version number from Section 4.1.3.</span></li>
<li>Set all the other bits to randomly (or pseudo-randomly) chosen values.</li>
</ul>
</blockquote>
<p>The format:<br />
xxxxxxxx-xxxx-<span style="background-color:#66FF00">x</span>xxx-<span style="background-color:#6699FF">x</span>xxx-xxxxxxxxxxxx</p>
<p>[For more in-depth analysis of how a UUID is constructed refer to <a href="http://tools.ietf.org/html/rfc4122">http://tools.ietf.org/html/rfc4122</a>]</p>
<p>Creating a version 4 UUID requires a bunch of random hexadecimal data, with one hexadecimal character (<span style="background-color:#66FF00">x</span>) (equivalent to a nibble &#8211; 4 bits for those of you who don&#8217;t recall) set to the value of 4 (binary 0100 from Section 4.1.3 of the RFC) and one hexadecimal character (<span style="background-color:#6699FF">x</span>) set to one of 4 values: 8, 9, a or b; which is what the first nibble of a byte is when the two most significant bits are 10. For proof of this see below:</p>
<table border="1">
<tr>
<th colspan="4" bgcolor="#CCCC66">Bit</th>
<td></td>
<td></td>
</tr>
<tr>
<th bgcolor="#CCCC66">3</th>
<th bgcolor="#CCCC66">2</th>
<th bgcolor="#CCCC66">1</th>
<th bgcolor="#CCCC66">0</th>
<th bgcolor="#CCCC66">Hex</th>
<th bgcolor="#CCCC66">Dec</th>
</tr>
<tr>
<td>1</td>
<td>0</td>
<td>0</td>
<td>0</td>
<td>8</td>
<td>8</td>
</tr>
<tr>
<td>1</td>
<td>0</td>
<td>0</td>
<td>1</td>
<td>9</td>
<td>9</td>
</tr>
<tr>
<td>1</td>
<td>0</td>
<td>1</td>
<td>0</td>
<td>a</td>
<td>10</td>
</tr>
<tr>
<td>1</td>
<td>0</td>
<td>1</td>
<td>1</td>
<td>b</td>
<td>11</td>
</tr>
</table>
<p>Now let&#8217;s look at what means we have for generating random data in hexadecimal format. PostgreSQL includes a random() function which generates a double precision number between 0 and 1. We also have a to_hex() function that will convert integer or binary string data to a hexadecimal number. This is a start, but we really don&#8217;t want to be calling random() more often than we need to, so is there a way to generate a bunch of hexadecimal data at one shot? Actually, there is, if we just add a sha1 function. So let&#8217;s start there:</p>
<div class="synthi_code" style="display:none;" id ="plain_synthi_4c8aefc940600">
<div class="synthi_header" style="font-weight:bold;"> SQL <span  class="synthi_button"style="font-weight:lighter;font-size:smaller;">[<a href="#" onClick="javascript:document.getElementById('styled_synthi_4c8aefc940600').style.display='block';document.getElementById('plain_synthi_4c8aefc940600').style.display='none';return false">Show Styled Code</a>]:</span></div>
<pre style="width:100%;overflow:auto;">
CREATE OR REPLACE FUNCTION sha1(text)
  RETURNS character AS
$BODY$
BEGIN
RETURN ENCODE(DIGEST($1, 'sha1'), 'hex');
END;
$BODY$
  LANGUAGE 'plpgsql';
</pre>
</div>
<div class="synthi_code" style="display:block;" id ="styled_synthi_4c8aefc940600">
<div class="synthi_header" style="font-weight:bold;"> SQL <span  class="synthi_button"style="font-weight:lighter;font-size:smaller;">[<a href="#" onClick="javascript:document.getElementById('plain_synthi_4c8aefc940600').style.display='block';document.getElementById('styled_synthi_4c8aefc940600').style.display='none';return false">Show Plain Code</a>]:</span></div>
<div class="sql" style="font-family: monospace;">
<ol>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 1.2em;"><span style="color: #993333; font-weight: bold;">CREATE</span> <span style="color: #993333; font-weight: bold;">OR</span> <span style="color: #993333; font-weight: bold;">REPLACE</span> <span style="color: #993333; font-weight: bold;">FUNCTION</span> sha1<span style="color: #66cc66;">&#40;</span>text<span style="color: #66cc66;">&#41;</span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 1.2em;">&nbsp; RETURNS character <span style="color: #993333; font-weight: bold;">AS</span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 1.2em;">$BODY$</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 1.2em;">BEGIN</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 1.2em;"><span style="color: #993333; font-weight: bold;">RETURN</span> ENCODE<span style="color: #66cc66;">&#40;</span>DIGEST<span style="color: #66cc66;">&#40;</span>$<span style="color: #cc66cc;">1</span>, <span style="color: #ff0000;">&#8216;sha1&#8242;</span><span style="color: #66cc66;">&#41;</span>, <span style="color: #ff0000;">&#8216;hex&#8217;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 1.2em;">END;</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 1.2em;">$BODY$</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 1.2em;">&nbsp; <span style="color: #993333; font-weight: bold;">LANGUAGE</span> <span style="color: #ff0000;">&#8216;plpgsql&#8217;</span>; </div>
</li>
</ol>
</div>
</div>
<p>Now we have a quick way to generate lots of hexadecimal characters, all we need now is to randomize, and format according to what we have stated above.</p>
<div class="synthi_code" style="display:none;" id ="plain_synthi_4c8aefc943579">
<div class="synthi_header" style="font-weight:bold;"> SQL <span  class="synthi_button"style="font-weight:lighter;font-size:smaller;">[<a href="#" onClick="javascript:document.getElementById('styled_synthi_4c8aefc943579').style.display='block';document.getElementById('plain_synthi_4c8aefc943579').style.display='none';return false">Show Styled Code</a>]:</span></div>
<pre style="width:100%;overflow:auto;">
CREATE OR REPLACE FUNCTION uuid()
  RETURNS character AS
$BODY$
SELECT SUBSTRING(x.my_rand FROM 1 FOR 8)||'-'||SUBSTRING(x.my_rand FROM 9 FOR 4)||'-4'||SUBSTRING(x.my_rand FROM 13 FOR 3)||'-'||x.clock_1||SUBSTRING(x.my_rand FROM 16 FOR 3)||'-'||SUBSTRING(x.my_rand FROM 19 FOR 12)
FROM
(SELECT sha1(''||now()||random()) as my_rand, to_hex(8+(3*random())::int) as clock_1) as x;$BODY$
  LANGUAGE 'sql';
</pre>
</div>
<div class="synthi_code" style="display:block;" id ="styled_synthi_4c8aefc943579">
<div class="synthi_header" style="font-weight:bold;"> SQL <span  class="synthi_button"style="font-weight:lighter;font-size:smaller;">[<a href="#" onClick="javascript:document.getElementById('plain_synthi_4c8aefc943579').style.display='block';document.getElementById('styled_synthi_4c8aefc943579').style.display='none';return false">Show Plain Code</a>]:</span></div>
<div class="sql" style="font-family: monospace;">
<ol>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 1.2em;"><span style="color: #993333; font-weight: bold;">CREATE</span> <span style="color: #993333; font-weight: bold;">OR</span> <span style="color: #993333; font-weight: bold;">REPLACE</span> <span style="color: #993333; font-weight: bold;">FUNCTION</span> uuid<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 1.2em;">&nbsp; RETURNS character <span style="color: #993333; font-weight: bold;">AS</span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 1.2em;">$BODY$</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 1.2em;"><span style="color: #993333; font-weight: bold;">SELECT</span> SUBSTRING<span style="color: #66cc66;">&#40;</span>x.my_rand <span style="color: #993333; font-weight: bold;">FROM</span> <span style="color: #cc66cc;">1</span> <span style="color: #993333; font-weight: bold;">FOR</span> <span style="color: #cc66cc;">8</span><span style="color: #66cc66;">&#41;</span>||<span style="color: #ff0000;">&#8216;-&#8217;</span>||SUBSTRING<span style="color: #66cc66;">&#40;</span>x.my_rand <span style="color: #993333; font-weight: bold;">FROM</span> <span style="color: #cc66cc;">9</span> <span style="color: #993333; font-weight: bold;">FOR</span> <span style="color: #cc66cc;">4</span><span style="color: #66cc66;">&#41;</span>||<span style="color: #ff0000;">&#8216;-4&#8242;</span>||SUBSTRING<span style="color: #66cc66;">&#40;</span>x.my_rand <span style="color: #993333; font-weight: bold;">FROM</span> <span style="color: #cc66cc;">13</span> <span style="color: #993333; font-weight: bold;">FOR</span> <span style="color: #cc66cc;">3</span><span style="color: #66cc66;">&#41;</span>||<span style="color: #ff0000;">&#8216;-&#8217;</span>||x.clock_1||SUBSTRING<span style="color: #66cc66;">&#40;</span>x.my_rand <span style="color: #993333; font-weight: bold;">FROM</span> <span style="color: #cc66cc;">16</span> <span style="color: #993333; font-weight: bold;">FOR</span> <span style="color: #cc66cc;">3</span><span style="color: #66cc66;">&#41;</span>||<span style="color: #ff0000;">&#8216;-&#8217;</span>||SUBSTRING<span style="color: #66cc66;">&#40;</span>x.my_rand <span style="color: #993333; font-weight: bold;">FROM</span> <span style="color: #cc66cc;">19</span> <span style="color: #993333; font-weight: bold;">FOR</span> <span style="color: #cc66cc;">12</span><span style="color: #66cc66;">&#41;</span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 1.2em;"><span style="color: #993333; font-weight: bold;">FROM</span>&nbsp; </div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 1.2em;"><span style="color: #66cc66;">&#40;</span><span style="color: #993333; font-weight: bold;">SELECT</span> sha1<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&#8221;</span>||now<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>||random<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #993333; font-weight: bold;">AS</span> my_rand, to_hex<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">8</span>+<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">3</span>*random<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>::int<span style="color: #66cc66;">&#41;</span> <span style="color: #993333; font-weight: bold;">AS</span> clock_1<span style="color: #66cc66;">&#41;</span> <span style="color: #993333; font-weight: bold;">AS</span> x;$BODY$</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 1.2em;">&nbsp; <span style="color: #993333; font-weight: bold;">LANGUAGE</span> <span style="color: #ff0000;">&#8216;sql&#8217;</span>; </div>
</li>
</ol>
</div>
</div>
<p>Notice that we are using now() to grab the current timestamp (including milliseconds), and concatenating that with the output of random to feed to sha1() to generate a hex digest. We are also generating a value of either 8, 9, a, or b for the first nibble in the clock_seq_hi field (the character highlighted in blue) by adding the value of 3 * random() cast as an integer to 8 and then returning that as a hex value. We then use SUBSTRING to pull the number of characters we need for each chunk and keep on moving left to right in the hash to grab the next values and concatenate them with dashes where needed and our version number.</p>
<p>For this and other PostgreSQL functions I use regularly you can <a href="http://www.evardsson.com/files/postgres_crypt.sql">download this SQL file</a>.</p>
<p align="left"><a class="tt" href="http://twitter.com/home/?status=UUID+Why+and+How+http://ztokb.th8.us" title="Post to Twitter"><img class="nothumb" src="http://www.evardsson.com/blog/wp-content/plugins/tweet-this/icons/tt-twitter.png" alt="Post to Twitter" /></a> <a class="tt" href="http://buzz.yahoo.com/submit?submitUrl=http://www.evardsson.com/blog/2009/01/15/uuid-why-and-how/&amp;submitHeadline=UUID+Why+and+How" title="Post to Yahoo Buzz"><img class="nothumb" src="http://www.evardsson.com/blog/wp-content/plugins/tweet-this/icons/tt-buzz.png" alt="Post to Yahoo Buzz" /></a> <a class="tt" href="http://buzz.yahoo.com/submit?submitUrl=http://www.evardsson.com/blog/2009/01/15/uuid-why-and-how/&amp;submitHeadline=UUID+Why+and+How" title="Post to Yahoo Buzz">Buzz This Post</a> <a class="tt" href="http://delicious.com/post?url=http://www.evardsson.com/blog/2009/01/15/uuid-why-and-how/&amp;title=UUID+Why+and+How" title="Post to Delicious"><img class="nothumb" src="http://www.evardsson.com/blog/wp-content/plugins/tweet-this/icons/tt-delicious.png" alt="Post to Delicious" /></a> <a class="tt" href="http://delicious.com/post?url=http://www.evardsson.com/blog/2009/01/15/uuid-why-and-how/&amp;title=UUID+Why+and+How" title="Post to Delicious">Delicious</a> <a class="tt" href="http://digg.com/submit?url=http://www.evardsson.com/blog/2009/01/15/uuid-why-and-how/&amp;title=UUID+Why+and+How" title="Post to Digg"><img class="nothumb" src="http://www.evardsson.com/blog/wp-content/plugins/tweet-this/icons/tt-digg.png" alt="Post to Digg" /></a> <a class="tt" href="http://digg.com/submit?url=http://www.evardsson.com/blog/2009/01/15/uuid-why-and-how/&amp;title=UUID+Why+and+How" title="Post to Digg">Digg This Post</a> <a class="tt" href="http://ping.fm/ref/?method=microblog&amp;title=UUID+Why+and+How&amp;link=http://www.evardsson.com/blog/2009/01/15/uuid-why-and-how/" title="Post to Ping.fm"><img class="nothumb" src="http://www.evardsson.com/blog/wp-content/plugins/tweet-this/icons/tt-ping.png" alt="Post to Ping.fm" /></a> <a class="tt" href="http://ping.fm/ref/?method=microblog&amp;title=UUID+Why+and+How&amp;link=http://www.evardsson.com/blog/2009/01/15/uuid-why-and-how/" title="Post to Ping.fm">Ping This Post</a> <a class="tt" href="http://reddit.com/submit?url=http://www.evardsson.com/blog/2009/01/15/uuid-why-and-how/&amp;title=UUID+Why+and+How" title="Post to Reddit"><img class="nothumb" src="http://www.evardsson.com/blog/wp-content/plugins/tweet-this/icons/tt-reddit.png" alt="Post to Reddit" /></a> <a class="tt" href="http://reddit.com/submit?url=http://www.evardsson.com/blog/2009/01/15/uuid-why-and-how/&amp;title=UUID+Why+and+How" title="Post to Reddit">Reddit</a> <a class="tt" href="http://stumbleupon.com/submit?url=http://www.evardsson.com/blog/2009/01/15/uuid-why-and-how/&amp;title=UUID+Why+and+How" title="Post to StumbleUpon"><img class="nothumb" src="http://www.evardsson.com/blog/wp-content/plugins/tweet-this/icons/tt-su.png" alt="Post to StumbleUpon" /></a> <a class="tt" href="http://stumbleupon.com/submit?url=http://www.evardsson.com/blog/2009/01/15/uuid-why-and-how/&amp;title=UUID+Why+and+How" title="Post to StumbleUpon">Stumble This Post</a></p>]]></content:encoded>
			<wfw:commentRss>http://www.evardsson.com/blog/2009/01/15/uuid-why-and-how/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Why PostgreSQL</title>
		<link>http://www.evardsson.com/blog/2006/03/18/why-postgresql/</link>
		<comments>http://www.evardsson.com/blog/2006/03/18/why-postgresql/#comments</comments>
		<pubDate>Sat, 18 Mar 2006 09:23:00 +0000</pubDate>
		<dc:creator>Sjan Evardsson</dc:creator>
				<category><![CDATA[Database]]></category>
		<category><![CDATA[PostgresQL]]></category>

		<guid isPermaLink="false">http://www.evardsson.com/blog/2006/03/18/why-postgresql/</guid>
		<description><![CDATA[This article about PostgreSQL answers the five most common excuses people give for not trying PostgreSQL, or for sticking with their proprietary RDBMS (such as Oracle or SQL Server). Buzz This Post Delicious Digg This Post Ping This Post Reddit Stumble This Post]]></description>
			<content:encoded><![CDATA[<p>This article about <a href="http://searchopensource.techtarget.com/originalContent/0,289142,sid39_gci1172668,00.html" target="_blank" rel="tag">PostgreSQL</a> answers the five most common excuses people give for not trying PostgreSQL, or for sticking with their proprietary RDBMS (such as Oracle or SQL Server).</p>
<p align="left"><a class="tt" href="http://twitter.com/home/?status=Why+PostgreSQL+http://i9dqi.th8.us" title="Post to Twitter"><img class="nothumb" src="http://www.evardsson.com/blog/wp-content/plugins/tweet-this/icons/tt-twitter.png" alt="Post to Twitter" /></a> <a class="tt" href="http://buzz.yahoo.com/submit?submitUrl=http://www.evardsson.com/blog/2006/03/18/why-postgresql/&amp;submitHeadline=Why+PostgreSQL" title="Post to Yahoo Buzz"><img class="nothumb" src="http://www.evardsson.com/blog/wp-content/plugins/tweet-this/icons/tt-buzz.png" alt="Post to Yahoo Buzz" /></a> <a class="tt" href="http://buzz.yahoo.com/submit?submitUrl=http://www.evardsson.com/blog/2006/03/18/why-postgresql/&amp;submitHeadline=Why+PostgreSQL" title="Post to Yahoo Buzz">Buzz This Post</a> <a class="tt" href="http://delicious.com/post?url=http://www.evardsson.com/blog/2006/03/18/why-postgresql/&amp;title=Why+PostgreSQL" title="Post to Delicious"><img class="nothumb" src="http://www.evardsson.com/blog/wp-content/plugins/tweet-this/icons/tt-delicious.png" alt="Post to Delicious" /></a> <a class="tt" href="http://delicious.com/post?url=http://www.evardsson.com/blog/2006/03/18/why-postgresql/&amp;title=Why+PostgreSQL" title="Post to Delicious">Delicious</a> <a class="tt" href="http://digg.com/submit?url=http://www.evardsson.com/blog/2006/03/18/why-postgresql/&amp;title=Why+PostgreSQL" title="Post to Digg"><img class="nothumb" src="http://www.evardsson.com/blog/wp-content/plugins/tweet-this/icons/tt-digg.png" alt="Post to Digg" /></a> <a class="tt" href="http://digg.com/submit?url=http://www.evardsson.com/blog/2006/03/18/why-postgresql/&amp;title=Why+PostgreSQL" title="Post to Digg">Digg This Post</a> <a class="tt" href="http://ping.fm/ref/?method=microblog&amp;title=Why+PostgreSQL&amp;link=http://www.evardsson.com/blog/2006/03/18/why-postgresql/" title="Post to Ping.fm"><img class="nothumb" src="http://www.evardsson.com/blog/wp-content/plugins/tweet-this/icons/tt-ping.png" alt="Post to Ping.fm" /></a> <a class="tt" href="http://ping.fm/ref/?method=microblog&amp;title=Why+PostgreSQL&amp;link=http://www.evardsson.com/blog/2006/03/18/why-postgresql/" title="Post to Ping.fm">Ping This Post</a> <a class="tt" href="http://reddit.com/submit?url=http://www.evardsson.com/blog/2006/03/18/why-postgresql/&amp;title=Why+PostgreSQL" title="Post to Reddit"><img class="nothumb" src="http://www.evardsson.com/blog/wp-content/plugins/tweet-this/icons/tt-reddit.png" alt="Post to Reddit" /></a> <a class="tt" href="http://reddit.com/submit?url=http://www.evardsson.com/blog/2006/03/18/why-postgresql/&amp;title=Why+PostgreSQL" title="Post to Reddit">Reddit</a> <a class="tt" href="http://stumbleupon.com/submit?url=http://www.evardsson.com/blog/2006/03/18/why-postgresql/&amp;title=Why+PostgreSQL" title="Post to StumbleUpon"><img class="nothumb" src="http://www.evardsson.com/blog/wp-content/plugins/tweet-this/icons/tt-su.png" alt="Post to StumbleUpon" /></a> <a class="tt" href="http://stumbleupon.com/submit?url=http://www.evardsson.com/blog/2006/03/18/why-postgresql/&amp;title=Why+PostgreSQL" title="Post to StumbleUpon">Stumble This Post</a></p>]]></content:encoded>
			<wfw:commentRss>http://www.evardsson.com/blog/2006/03/18/why-postgresql/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
