<?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>Flapping Head &#187; Postgresql</title>
	<atom:link href="http://scottbarnham.com/blog/category/postgresql/feed/" rel="self" type="application/rss+xml" />
	<link>http://scottbarnham.com/blog</link>
	<description>Code and comments on web development, Django, Python and things (un)related.</description>
	<lastBuildDate>Mon, 16 May 2011 19:22:44 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Make a slug in PostgreSQL translating diacritics</title>
		<link>http://scottbarnham.com/blog/2010/12/20/make-a-slug-in-postgresql-translating-diacritics/</link>
		<comments>http://scottbarnham.com/blog/2010/12/20/make-a-slug-in-postgresql-translating-diacritics/#comments</comments>
		<pubDate>Mon, 20 Dec 2010 20:09:57 +0000</pubDate>
		<dc:creator>Scott</dc:creator>
				<category><![CDATA[Postgresql]]></category>

		<guid isPermaLink="false">http://scottbarnham.com/blog/?p=79</guid>
		<description><![CDATA[I needed to make slugs in Postgresql from names which included diacritics.  Though not complete, here&#8217;s a reasonable stab at it:
select regexp_replace(translate(replace(lower(your_field_name_here), ' ', '-'), 'áàâãäåāăąÁÂÃÄÅĀĂĄèééêëēĕėęěĒĔĖĘĚìíîïìĩīĭÌÍÎÏÌĨĪĬóôõöōŏőÒÓÔÕÖŌŎŐùúûüũūŭůÙÚÛÜŨŪŬŮ','aaaaaaaaaaaaaaaaaeeeeeeeeeeeeeeeiiiiiiiiiiiiiiiiooooooooooooooouuuuuuuuuuuuuuuu'), '[^\w -]', '', 'g') as slug
The translate is not quite right because it translates some uppercase to lowercase, but it&#8217;s all lowercase for the slug, so it doesn&#8217;t [...]]]></description>
			<content:encoded><![CDATA[<p>I needed to make slugs in Postgresql from names which included diacritics.  Though not complete, here&#8217;s a reasonable stab at it:</p>
<pre>select regexp_replace(translate(replace(lower(your_field_name_here), ' ', '-'), 'áàâãäåāăąÁÂÃÄÅĀĂĄèééêëēĕėęěĒĔĖĘĚìíîïìĩīĭÌÍÎÏÌĨĪĬóôõöōŏőÒÓÔÕÖŌŎŐùúûüũūŭůÙÚÛÜŨŪŬŮ','aaaaaaaaaaaaaaaaaeeeeeeeeeeeeeeeiiiiiiiiiiiiiiiiooooooooooooooouuuuuuuuuuuuuuuu'), '[^\w -]', '', 'g') as slug</pre>
<p>The translate is not quite right because it translates some uppercase to lowercase, but it&#8217;s all lowercase for the slug, so it doesn&#8217;t matter here.</p>
<p>[Update] Added &#8216;g&#8217; flag to regexp_replace to replace all occurrences, not just first.</p>
]]></content:encoded>
			<wfw:commentRss>http://scottbarnham.com/blog/2010/12/20/make-a-slug-in-postgresql-translating-diacritics/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Migrating Postgresql Databases the Easy Way</title>
		<link>http://scottbarnham.com/blog/2009/06/23/migrating-postgresql-databases-the-easy-way/</link>
		<comments>http://scottbarnham.com/blog/2009/06/23/migrating-postgresql-databases-the-easy-way/#comments</comments>
		<pubDate>Tue, 23 Jun 2009 10:45:52 +0000</pubDate>
		<dc:creator>Scott</dc:creator>
				<category><![CDATA[Postgresql]]></category>

		<guid isPermaLink="false">http://scottbarnham.com/blog/2009/06/23/migrating-postgresql-databases-the-easy-way/</guid>
		<description><![CDATA[When you upgrade Postgresl to a new major version (e.g. 8.1 to 8.3), all databases need to be dumped from the old version and loaded in to the new version.  It&#8217;s not difficult, but on Debian there&#8217;s a really easy way.
Debian has pg_createcluster, pg_dropcluster and pg_upgradecluster (plus a few others).  The one I&#8217;m [...]]]></description>
			<content:encoded><![CDATA[<p>When you upgrade Postgresl to a new major version (e.g. 8.1 to 8.3), all databases need to be dumped from the old version and loaded in to the new version.  It&#8217;s not difficult, but on Debian there&#8217;s a really easy way.</p>
<p>Debian has <code>pg_createcluster</code>, <code>pg_dropcluster</code> and <code>pg_upgradecluster</code> (plus a few others).  The one I&#8217;m referring to here is <code>pg_upgradecluster</code>.</p>
<p>It takes the version and cluster name of the databases you want to upgrade.</p>
<p>e.g. if you&#8217;ve installed Postgresql 8.3 and have databases in 8.1, just run:</p>
<p><code># pg_upgradecluster 8.1 main</code></p>
<p>This upgrades the databases in the &#8220;main&#8221; cluster under version 8.1 and puts them under &#8220;main&#8221; in version 8.3.  If you already have a &#8220;main&#8221; cluster in 8.3, you&#8217;ll need to drop it first.</p>
<p>This little tool not only dumps and loads the database, but it also changes the config so 8.3 runs on the standard port previously used by 8.1 (or whatever your older version).  A painless way to upgrade.</p>
]]></content:encoded>
			<wfw:commentRss>http://scottbarnham.com/blog/2009/06/23/migrating-postgresql-databases-the-easy-way/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

<!-- Dynamic Page Served (once) in 0.188 seconds -->

