<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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/"
		>
<channel>
	<title>Comments on: Atomic Translations &#8211; Part 2 &#8211; Translated Text as a Data Type in PostgreSQL</title>
	<atom:link href="http://rwec.co.uk/blog/2009/12/atomic-translations-part-2/feed/" rel="self" type="application/rss+xml" />
	<link>http://rwec.co.uk/blog/2009/12/atomic-translations-part-2/</link>
	<description>Rowan&#039;s World, Et Cetera</description>
	<lastBuildDate>Wed, 16 May 2012 12:34:05 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
	<item>
		<title>By: Rowan</title>
		<link>http://rwec.co.uk/blog/2009/12/atomic-translations-part-2/comment-page-1/#comment-30661</link>
		<dc:creator>Rowan</dc:creator>
		<pubDate>Wed, 16 May 2012 12:34:05 +0000</pubDate>
		<guid isPermaLink="false">http://rwec.co.uk/blog/?p=60#comment-30661</guid>
		<description>Easy! :) A WHERE clause can have all the same syntax as a SELECT clause, so you just query against whichever translation you want:

SELECT * FROM &quot;countries&quot; WHERE &quot;name&quot;-&gt;&#039;en&#039; LIKE &#039;Ger%&#039;

It does mean the function is being run on every column in the table, so there are performance considerations, but that&#039;s true of most of the schemas I&#039;ve seen for translating this kind of data (One Big Table, tables where you previously had columns, etc, all lead to much more complex query plans).

I haven&#039;t looked into it in detail, but I think you could build an index on (&quot;name&quot;-&gt;&#039;en&#039;) if you knew that you were going to query it in a way that would hit the index. Although if you were doing pattern matching, that might not help anyway...

Meanwhile, I must get round to updating the version online with the fixes that have been made to get it working in production here.</description>
		<content:encoded><![CDATA[<p>Easy! :) A WHERE clause can have all the same syntax as a SELECT clause, so you just query against whichever translation you want:</p>
<p>SELECT * FROM "countries" WHERE "name"->'en' LIKE 'Ger%'</p>
<p>It does mean the function is being run on every column in the table, so there are performance considerations, but that's true of most of the schemas I've seen for translating this kind of data (One Big Table, tables where you previously had columns, etc, all lead to much more complex query plans).</p>
<p>I haven't looked into it in detail, but I think you could build an index on ("name"->'en') if you knew that you were going to query it in a way that would hit the index. Although if you were doing pattern matching, that might not help anyway...</p>
<p>Meanwhile, I must get round to updating the version online with the fixes that have been made to get it working in production here.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Taai</title>
		<link>http://rwec.co.uk/blog/2009/12/atomic-translations-part-2/comment-page-1/#comment-30658</link>
		<dc:creator>Taai</dc:creator>
		<pubDate>Wed, 16 May 2012 11:50:23 +0000</pubDate>
		<guid isPermaLink="false">http://rwec.co.uk/blog/?p=60#comment-30658</guid>
		<description>Very interesting and useful. But how to do a search, for example, SELECT * FROM &quot;countries&quot; WHERE &quot;name&quot; LIKE &#039;Ger%&#039; ?</description>
		<content:encoded><![CDATA[<p>Very interesting and useful. But how to do a search, for example, SELECT * FROM "countries" WHERE "name" LIKE 'Ger%' ?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Rowan</title>
		<link>http://rwec.co.uk/blog/2009/12/atomic-translations-part-2/comment-page-1/#comment-1250</link>
		<dc:creator>Rowan</dc:creator>
		<pubDate>Tue, 31 Aug 2010 14:41:33 +0000</pubDate>
		<guid isPermaLink="false">http://rwec.co.uk/blog/?p=60#comment-1250</guid>
		<description>Hi!

I haven&#039;t had a chance to try hstore yet - I&#039;ve only recently got myself a decent dev environment where I could play around with installing that kind of thing. It&#039;s certainly something I should look into, as it&#039;s likely to have plenty of advantages over my cobbled together array system.

As for production use, I did persuade my colleagues to use it for some data like lists of resorts to use on a new Spanish website, and apart from a couple of inconsistencies with the way different Postgres versions handled the custom operators, which I need to look into, it seems to have worked out quite well. (I think the problem was with the wrong version of &#124;&#124; being called, worked around by defining &#124;&#124;&#124; instead...)

Rowan</description>
		<content:encoded><![CDATA[<p>Hi!</p>
<p>I haven't had a chance to try hstore yet - I've only recently got myself a decent dev environment where I could play around with installing that kind of thing. It's certainly something I should look into, as it's likely to have plenty of advantages over my cobbled together array system.</p>
<p>As for production use, I did persuade my colleagues to use it for some data like lists of resorts to use on a new Spanish website, and apart from a couple of inconsistencies with the way different Postgres versions handled the custom operators, which I need to look into, it seems to have worked out quite well. (I think the problem was with the wrong version of || being called, worked around by defining ||| instead...)</p>
<p>Rowan</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Werner</title>
		<link>http://rwec.co.uk/blog/2009/12/atomic-translations-part-2/comment-page-1/#comment-1207</link>
		<dc:creator>Werner</dc:creator>
		<pubDate>Tue, 24 Aug 2010 16:04:31 +0000</pubDate>
		<guid isPermaLink="false">http://rwec.co.uk/blog/?p=60#comment-1207</guid>
		<description>Very interesting approach!   Have you ever tried it with the &quot;hstore&quot;? 

Anyone tried it in production?

Werner</description>
		<content:encoded><![CDATA[<p>Very interesting approach!   Have you ever tried it with the "hstore"? </p>
<p>Anyone tried it in production?</p>
<p>Werner</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: rwec.co.uk &#187; Atomic Translations &#8211; Part 1 &#8211; Database i18n as a Data Type Problem</title>
		<link>http://rwec.co.uk/blog/2009/12/atomic-translations-part-2/comment-page-1/#comment-83</link>
		<dc:creator>rwec.co.uk &#187; Atomic Translations &#8211; Part 1 &#8211; Database i18n as a Data Type Problem</dc:creator>
		<pubDate>Sat, 12 Dec 2009 23:44:35 +0000</pubDate>
		<guid isPermaLink="false">http://rwec.co.uk/blog/?p=60#comment-83</guid>
		<description>[...] Atomic Translations &#8211; Part 2 &#8211; Translated Text as a Data Type in PostgreSQL  [...]</description>
		<content:encoded><![CDATA[<p>[...] Atomic Translations &#8211; Part 2 &#8211; Translated Text as a Data Type in PostgreSQL  [...]</p>
]]></content:encoded>
	</item>
</channel>
</rss>

