<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<feed xmlns="http://www.w3.org/2005/Atom">

	<title>..::Planet PostgreSQL::..</title>
	<link rel="self" href="http://www.planetpostgresql.org/atom.xml"/>
	<link href="http://www.planetpostgresql.org/"/>
	<id>http://www.planetpostgresql.org/atom.xml</id>
	<updated>2010-09-02T14:31:11+00:00</updated>
	<generator uri="http://www.planetplanet.org/">Planet/2.0 +http://www.planetplanet.org</generator>

	<entry xml:lang="en">
		<title type="html">Explaining MVCC in Postgres: system defined columns</title>
		<link href="http://www.chesnok.com/daily/2010/09/01/explaining-mvcc-in-postgres-system-defined-columns/"/>
		<id>http://www.chesnok.com/daily/?p=1921</id>
		<updated>2010-09-01T15:00:57+00:00</updated>
		<content type="html">&lt;p&gt;&lt;a href=&quot;http://www.chesnok.com/daily/wp-content/uploads/2010/09/Untitled.png&quot;&gt;&lt;img src=&quot;http://www.chesnok.com/daily/wp-content/uploads/2010/09/Untitled.png&quot; alt=&quot;&quot; title=&quot;How MVCC is implemented in PostgreSQL&quot; width=&quot;300&quot; height=&quot;218&quot; class=&quot;aligncenter size-full wp-image-1922&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;I&amp;#8217;m playing around with some diagrams for explaining MVCC that I&amp;#8217;ll be posting here over the next few days. Not sure if I&amp;#8217;ll end up giving up on slides and just use a whiteboard for the talk. I made an &lt;a href=&quot;http://www.slideshare.net/selenamarie/illustrated-buffer-cache&quot;&gt;illustrated shared buffers&lt;/a&gt; deck to go along with Greg Smith&amp;#8217;s excellent talk on shared buffers a while back. This is the beginning of a talk that I hope will emulate that.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://www.chesnok.com/daily/wp-content/uploads/2010/09/mvcc_in_postgres.pdf&quot;&gt;Here are my first few slides&lt;/a&gt;, showing the system-defined columns. The next few slides will describe optimizations PostgreSQL has for managing the side effects of our pessimistic rollback strategy, and reducing IO during vacuuming and index updates.&lt;/p&gt;


&lt;p&gt;Related posts:&lt;ol&gt;&lt;li&gt;&lt;a href=&quot;http://www.chesnok.com/daily/2008/11/26/postgres-mailing-list-traffic-over-time/&quot; rel=&quot;bookmark&quot; title=&quot;Permanent Link: Postgres mailing list traffic over time&quot;&gt;Postgres mailing list traffic over time&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://www.chesnok.com/daily/2009/02/10/fsm-visibility-map-and-new-vacuum-awesomeness/&quot; rel=&quot;bookmark&quot; title=&quot;Permanent Link: FSM, visibility map and new VACUUM awesomeness&quot;&gt;FSM, visibility map and new VACUUM awesomeness&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://www.chesnok.com/daily/2010/05/26/pgcon-2010-plparrot-simulated-annealing-exclusion-constraints-postgres-xc/&quot; rel=&quot;bookmark&quot; title=&quot;Permanent Link: PgCon 2010 &amp;#8211; PL/Parrot, Simulated Annealing, Exclusion Constraints, Postgres-XC&quot;&gt;PgCon 2010 &amp;#8211; PL/Parrot, Simulated Annealing, Exclusion Constraints, Postgres-XC&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;&lt;/p&gt;</content>
		<author>
			<name>selena</name>
			<uri>http://www.chesnok.com/daily</uri>
		</author>
		<source>
			<title type="html">tending the garden</title>
			<subtitle type="html">selena marie deckelmann's blog</subtitle>
			<link rel="self" href="http://www.chesnok.com/daily/feed/atom/"/>
			<id>http://www.chesnok.com/daily/feed/atom/</id>
			<updated>2010-09-02T14:30:47+00:00</updated>
		</source>
	</entry>

	<entry xml:lang="en">
		<title type="html">Using logger with pg_standby</title>
		<link href="http://www.chesnok.com/daily/2010/08/29/using-logger-with-pg_standby/"/>
		<id>http://www.chesnok.com/daily/?p=1887</id>
		<updated>2010-08-31T23:49:14+00:00</updated>
		<content type="html">&lt;p&gt;Piping logs to syslog is pretty useful for automating log rotation and forwarding lots of different logs to a central log server. &lt;/p&gt;
&lt;p&gt;To that end, the command-line utility &amp;#8216;logger&amp;#8217; is nice for piping output from utilities like pg_standby without having to add syslogging code to the utility itself. Another thing is that logger comes by default with modern packages of syslog.&lt;/p&gt;
&lt;p&gt;Here&amp;#8217;s an easy way to implement this: &lt;/p&gt;
&lt;p&gt;&lt;code&gt;&lt;br /&gt;
restore_command = 'pg_standby -d -s 2 -t /pgdata/trigger /shared/wal_archive/ %f %p %r 2&gt;&amp;#038;1 | logger -p local3.info -t pgstandby'&lt;br /&gt;
&lt;/code&gt;&lt;/p&gt;


&lt;p&gt;Related posts:&lt;ol&gt;&lt;li&gt;&lt;a href=&quot;http://www.chesnok.com/daily/2010/08/03/customizing-the-rpms-from-pgrpms-org/&quot; rel=&quot;bookmark&quot; title=&quot;Permanent Link: Customizing the RPMs from pgrpms.org&quot;&gt;Customizing the RPMs from pgrpms.org&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://www.chesnok.com/daily/2009/10/04/snow-leopard-and-postgresql-installation-help-links/&quot; rel=&quot;bookmark&quot; title=&quot;Permanent Link: Snow Leopard and PostgreSQL: installation help links&quot;&gt;Snow Leopard and PostgreSQL: installation help links&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://www.chesnok.com/daily/2009/04/02/gregs-three-talks-at-postgresql-conference-east/&quot; rel=&quot;bookmark&quot; title=&quot;Permanent Link: Greg&amp;#8217;s THREE talks at PostgreSQL Conference East&quot;&gt;Greg&amp;#8217;s THREE talks at PostgreSQL Conference East&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;&lt;/p&gt;</content>
		<author>
			<name>selena</name>
			<uri>http://www.chesnok.com/daily</uri>
		</author>
		<source>
			<title type="html">tending the garden</title>
			<subtitle type="html">selena marie deckelmann's blog</subtitle>
			<link rel="self" href="http://www.chesnok.com/daily/feed/atom/"/>
			<id>http://www.chesnok.com/daily/feed/atom/</id>
			<updated>2010-09-02T14:30:47+00:00</updated>
		</source>
	</entry>

	<entry xml:lang="en">
		<title type="html">PostgreSQL @ FrOSCamp 2010 in Zurich</title>
		<link href="http://andreas.scherbaum.la/blog/archives/731-PostgreSQL-FrOSCamp-2010-in-Zurich.html"/>
		<id>http://andreas.scherbaum.la/blog/archives/731-guid.html</id>
		<updated>2010-08-31T06:54:00+00:00</updated>
		<content type="html">&lt;div class=&quot;serendipity_authorpic&quot;&gt;&lt;img src=&quot;http://andreas.scherbaum.la/blog/templates/default/img/Andreas__ads__Scherbaum.jpg&quot; alt=&quot;Author&quot; title=&quot;Andreas 'ads' Scherbaum&quot; /&gt;&lt;br /&gt;&lt;span&gt;Andreas 'ads' Scherbaum&lt;/span&gt;&lt;/div&gt;&lt;p&gt;&lt;font&gt;There's a new FOSS conference taking place at the &lt;a target=&quot;_blank&quot; href=&quot;http://andreas.scherbaum.la/blog/exit.php?url_id=8330&amp;amp;entry_id=731&quot; title=&quot;http://ethz.ch/index_EN&quot;&gt;ETH in Zurich&lt;/a&gt;, called &lt;a target=&quot;_blank&quot; href=&quot;http://andreas.scherbaum.la/blog/exit.php?url_id=8331&amp;amp;entry_id=731&quot; title=&quot;http://www.froscamp.org/&quot;&gt;FrOSCamp&lt;/a&gt;. It's a two day conference but unlike many others it's on friday and saturday, september 17th/18th. &lt;a target=&quot;_blank&quot; href=&quot;http://andreas.scherbaum.la/blog/exit.php?url_id=8332&amp;amp;entry_id=731&quot; title=&quot;https://fedoraproject.org/wiki/FUDCon:Zurich_2010&quot;&gt;FUDCon&lt;/a&gt;, the Fedora conference, is running parallel to FrOSCamp. Same time, same location.&lt;/font&gt;&lt;/p&gt; 
&lt;p&gt;&lt;font&gt;The &lt;a target=&quot;_blank&quot; href=&quot;http://andreas.scherbaum.la/blog/exit.php?url_id=8333&amp;amp;entry_id=731&quot; title=&quot;http://postgres-support.ch/&quot;&gt;PostgreSQL guys from Switzerland&lt;/a&gt; and myself submitted a project booth and several talks and workshops. Four talks and workshops as well as the booth got accepted. You can attend:&lt;/font&gt;&lt;/p&gt; 
&lt;ol&gt; 
&lt;li&gt;&lt;font&gt;&lt;a target=&quot;_blank&quot; href=&quot;http://andreas.scherbaum.la/blog/exit.php?url_id=8334&amp;amp;entry_id=731&quot; title=&quot;http://wiki.froscamp.org/2010:Talks_and_Workshops#PostGIS.2FPostgreSQL_f.C3.BCr_interaktive_Karten&quot;&gt;PostGIS/PostgreSQL for interactive maps&lt;/a&gt; (talk, speaker: Stefan Keller)&lt;br /&gt;&lt;/font&gt;&lt;/li&gt; 
&lt;li&gt;&lt;font&gt;&lt;a target=&quot;_blank&quot; href=&quot;http://andreas.scherbaum.la/blog/exit.php?url_id=8335&amp;amp;entry_id=731&quot; title=&quot;http://wiki.froscamp.org/2010:Talks_and_Workshops#Replikation_mit_PostgreSQL_9.0&quot;&gt;Replication with PostgreSQL 9.0&lt;/a&gt; (workshop, speaker: Andreas Scherbaum)&lt;/font&gt;&lt;/li&gt; 
&lt;li&gt;&lt;font&gt;&lt;a target=&quot;_blank&quot; href=&quot;http://andreas.scherbaum.la/blog/exit.php?url_id=8336&amp;amp;entry_id=731&quot; title=&quot;http://wiki.froscamp.org/2010:Talks_and_Workshops#PostgreSQL_Administration_und_Optimierung&quot;&gt;PostgreSQL administration and optimization&lt;/a&gt; (talk, speaker: &lt;a target=&quot;_blank&quot; href=&quot;http://andreas.scherbaum.la/blog/exit.php?url_id=8337&amp;amp;entry_id=731&quot; title=&quot;http://www.itos-gmbh.com/kontakt.html&quot;&gt;Stephan Wagner&lt;/a&gt;)&lt;/font&gt;&lt;/li&gt; 
&lt;li&gt;&lt;font&gt;&lt;a target=&quot;_blank&quot; href=&quot;http://andreas.scherbaum.la/blog/exit.php?url_id=8341&amp;amp;entry_id=731&quot; title=&quot;http://wiki.froscamp.org/2010:Talks_and_Workshops#Was_gibt_es_neues_in_PostgreSQL_9.0.3F&quot;&gt;What's new in PostgreSQL 9.0?&lt;/a&gt; (talk, speaker: Andreas Scherbaum)&lt;br /&gt;&lt;/font&gt;&lt;/li&gt; 
&lt;/ol&gt; 
&lt;p&gt;&lt;font&gt;&lt;a target=&quot;_blank&quot; href=&quot;http://andreas.scherbaum.la/blog/exit.php?url_id=8339&amp;amp;entry_id=731&quot; title=&quot;http://wiki.froscamp.org/2010:Talks_and_Workshops&quot;&gt;Here is the full schedule&lt;/a&gt;. &lt;br /&gt;&lt;/font&gt;&lt;/p&gt; 
&lt;p&gt;&lt;font&gt;Come and visit us in &lt;a target=&quot;_blank&quot; href=&quot;http://andreas.scherbaum.la/blog/exit.php?url_id=8340&amp;amp;entry_id=731&quot; title=&quot;http://en.wikipedia.org/wiki/Z%C3%BCrich&quot;&gt;Zurich&lt;/a&gt;!&lt;br /&gt;&lt;/font&gt;&lt;/p&gt; 
&lt;p&gt;&lt;font&gt;&lt;br /&gt;&lt;/font&gt;&lt;/p&gt;</content>
		<author>
			<name>Andreas 'ads' Scherbaum</name>
			<email>nospam@example.com</email>
			<uri>http://andreas.scherbaum.la/blog/</uri>
		</author>
		<source>
			<title type="html">ads' corner - PostgreSQL News</title>
			<subtitle type="html">a place to store my stuff</subtitle>
			<link rel="self" href="http://andreas.scherbaum.la/blog/feeds/categories/17-PostgreSQL-News.rss"/>
			<id>http://andreas.scherbaum.la/blog/feeds/categories/17-PostgreSQL-News.rss</id>
			<updated>2010-08-31T10:15:50+00:00</updated>
		</source>
	</entry>

	<entry xml:lang="en">
		<title type="html">Variable substitution with psql</title>
		<link href="http://www.chesnok.com/daily/2010/08/30/variable-substitution-with-psql/"/>
		<id>http://www.chesnok.com/daily/?p=1901</id>
		<updated>2010-08-31T01:53:43+00:00</updated>
		<content type="html">&lt;p&gt;&lt;b&gt;Updated:&lt;/b&gt; Thanks @johto for s/:bar/:foo/. &lt;img src=&quot;http://www.chesnok.com/daily/wp-includes/images/smilies/icon_smile.gif&quot; alt=&quot;:)&quot; class=&quot;wp-smiley&quot; /&gt; &lt;/p&gt;
&lt;p&gt;A coworker asked about variable substitution with psql using &lt;code&gt;\set&lt;/code&gt;, and so I looked into it a bit further.&lt;/p&gt;
&lt;p&gt;You definitely can do things like this:&lt;br /&gt;
&lt;code&gt;&lt;br /&gt;
16:55 sdeckelmann@[local]:5432|postgres=&gt; \set test 'select * from :foo limit 10;'&lt;br /&gt;
16:56 sdeckelmann@[local]:5432|postgres=&gt; \set foo 'test'&lt;br /&gt;
16:56 sdeckelmann@[local]:5432|postgres=&gt; :test&lt;br /&gt;
myint&lt;br /&gt;
-------&lt;br /&gt;
     1&lt;br /&gt;
     2&lt;br /&gt;
     3&lt;br /&gt;
     4&lt;br /&gt;
     5&lt;br /&gt;
     6&lt;br /&gt;
     7&lt;br /&gt;
     8&lt;br /&gt;
     9&lt;br /&gt;
    10&lt;br /&gt;
(10 rows)&lt;br /&gt;
&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;But, what about something like this:&lt;/p&gt;
&lt;p&gt;&lt;code&gt;&lt;br /&gt;
=&gt; \set test 'select * from :var limit 10;'&lt;br /&gt;
=&gt; :test mytable&lt;br /&gt;
&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Unfortunately, this isn&amp;#8217;t supported. &lt;/p&gt;
&lt;p&gt;The best you could do is something pathological like:&lt;/p&gt;
&lt;p&gt;&lt;code&gt;=&gt; \set s 'select * from '&lt;br /&gt;
=&gt; \set pr ' limit 10;'&lt;br /&gt;
=&gt; :s mytable :pr&lt;br /&gt;
=&gt; :s test :pr&lt;br /&gt;
myint&lt;br /&gt;
-------&lt;br /&gt;
     1&lt;br /&gt;
     2&lt;br /&gt;
     3&lt;br /&gt;
     4&lt;br /&gt;
     5&lt;br /&gt;
     6&lt;br /&gt;
     7&lt;br /&gt;
     8&lt;br /&gt;
     9&lt;br /&gt;
    10&lt;br /&gt;
(10 rows)&lt;br /&gt;
&lt;/code&gt;&lt;br /&gt;
&lt;/p&gt;


&lt;p&gt;Related posts:&lt;ol&gt;&lt;li&gt;&lt;a href=&quot;http://www.chesnok.com/daily/2010/07/12/quick-start-on-hot-standby/&quot; rel=&quot;bookmark&quot; title=&quot;Permanent Link: Quick start on Hot Standby&quot;&gt;Quick start on Hot Standby&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://www.chesnok.com/daily/2007/10/13/psql-and-file-csv-exports/&quot; rel=&quot;bookmark&quot; title=&quot;Permanent Link: psql and file, CSV exports&quot;&gt;psql and file, CSV exports&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://www.chesnok.com/daily/2007/09/18/an-example-for-upcoming-very-brief-normalization-talk-part-1/&quot; rel=&quot;bookmark&quot; title=&quot;Permanent Link: an example for upcoming very brief normalization talk (part 1)&quot;&gt;an example for upcoming very brief normalization talk (part 1)&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;&lt;/p&gt;</content>
		<author>
			<name>selena</name>
			<uri>http://www.chesnok.com/daily</uri>
		</author>
		<source>
			<title type="html">tending the garden</title>
			<subtitle type="html">selena marie deckelmann's blog</subtitle>
			<link rel="self" href="http://www.chesnok.com/daily/feed/atom/"/>
			<id>http://www.chesnok.com/daily/feed/atom/</id>
			<updated>2010-09-02T14:30:47+00:00</updated>
		</source>
	</entry>

	<entry xml:lang="en-us">
		<title type="html">Happy Numbers</title>
		<link href="http://blog.tapoueh.org/blog.dim.html#%20Happy%20Numbers"/>
		<id>http://blog.tapoueh.org/blog.dim.html#%20Happy%20Numbers</id>
		<updated>2010-08-30T08:00:00+00:00</updated>
		<content type="html">&lt;p&gt;&lt;a name=&quot;20100830-11:00&quot; id=&quot;20100830-11:00&quot;&gt;&lt;/a&gt;
After discovering the excellent &lt;a href=&quot;http://gwene.org/&quot;&gt;Gwene&lt;/a&gt; service, which allows you to subscribe
to &lt;em&gt;newsgroups&lt;/em&gt; to read &lt;code&gt;RSS&lt;/code&gt; content (&lt;em&gt;blogs&lt;/em&gt;, &lt;em&gt;planets&lt;/em&gt;, &lt;em&gt;commits&lt;/em&gt;, etc), I came to
read this nice article about &lt;a href=&quot;http://programmingpraxis.com/2010/07/23/happy-numbers/&quot;&gt;Happy Numbers&lt;/a&gt;. That's a little problem that
fits well an interview style question, so I first solved it yesterday
evening in &lt;a href=&quot;http://blog.tapoueh.org/static/happy-numbers.el&quot;&gt;Emacs Lisp&lt;/a&gt; as that's the language I use the most those days.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p class=&quot;quoted&quot;&gt;
A happy number is defined by the following process. Starting with any
positive integer, replace the number by the sum of the squares of its
digits, and repeat the process until the number equals 1 (where it will
stay), or it loops endlessly in a cycle which does not include 1. Those
numbers for which this process ends in 1 are happy numbers, while those
that do not end in 1 are unhappy numbers (or sad numbers).&lt;/p&gt;

&lt;/blockquote&gt;

&lt;p&gt;Now, what about implementing the same in pure &lt;code&gt;SQL&lt;/code&gt;, for more fun? Now that's
interesting! After all, we didn't get &lt;code&gt;WITH RECURSIVE&lt;/code&gt; for tree traversal
only, &lt;a href=&quot;http://archives.postgresql.org/message-id/e08cc0400911042333o5361b21cu2c9438f82b1e55ce@mail.gmail.com&quot;&gt;did we&lt;/a&gt;?&lt;/p&gt;

&lt;p&gt;Unfortunately, we need a little helper function first, if only to ease the
reading of the recursive query. I didn't try to inline it, but here it goes:&lt;/p&gt;

&lt;pre class=&quot;src&quot;&gt;
&lt;span&gt;create&lt;/span&gt; &lt;span&gt;or&lt;/span&gt; replace &lt;span&gt;function&lt;/span&gt; &lt;span&gt;digits&lt;/span&gt;(x bigint)
  &lt;span&gt;returns&lt;/span&gt; setof &lt;span&gt;int&lt;/span&gt;
  &lt;span&gt;language&lt;/span&gt; &lt;span&gt;sql&lt;/span&gt;
&lt;span&gt;as&lt;/span&gt; $$
  &lt;span&gt;select&lt;/span&gt; &lt;span&gt;substring&lt;/span&gt;($1::text &lt;span&gt;from&lt;/span&gt; i &lt;span&gt;for&lt;/span&gt; 1)::&lt;span&gt;int&lt;/span&gt;
    &lt;span&gt;from&lt;/span&gt; generate_series(1, &lt;span&gt;length&lt;/span&gt;($1::text)) &lt;span&gt;as&lt;/span&gt; t(i)
$$;
&lt;/pre&gt;

&lt;p&gt;That was easy: it will output one row per digit of the input number — and
rather than resorting to powers of ten and divisions and remainders, we do
use plain old text representation and &lt;code&gt;substring&lt;/code&gt;. Now, to the real
problem. If you're read what is an happy number and already did read the
fine manual about &lt;a href=&quot;http://www.postgresql.org/docs/8.4/interactive/queries-with.html&quot;&gt;Recursive Query Evaluation&lt;/a&gt;, it should be quite easy to
read the following:&lt;/p&gt;

&lt;pre class=&quot;src&quot;&gt;
&lt;span&gt;with&lt;/span&gt; &lt;span&gt;recursive&lt;/span&gt; happy(n, seen) &lt;span&gt;as&lt;/span&gt; (
    &lt;span&gt;select&lt;/span&gt; 7::bigint, &lt;span&gt;'{}'&lt;/span&gt;::bigint[]
  &lt;span&gt;union&lt;/span&gt; &lt;span&gt;all&lt;/span&gt;
    &lt;span&gt;select&lt;/span&gt; &lt;span&gt;sum&lt;/span&gt;(d*d), h.seen || &lt;span&gt;sum&lt;/span&gt;(d*d)
      &lt;span&gt;from&lt;/span&gt; (&lt;span&gt;select&lt;/span&gt; n, digits(n) &lt;span&gt;as&lt;/span&gt; d, seen
              &lt;span&gt;from&lt;/span&gt; happy
           ) &lt;span&gt;as&lt;/span&gt; h
  &lt;span&gt;group&lt;/span&gt; &lt;span&gt;by&lt;/span&gt; h.n, h.seen
    &lt;span&gt;having&lt;/span&gt; &lt;span&gt;not&lt;/span&gt; seen @&amp;gt; &lt;span&gt;array&lt;/span&gt;[&lt;span&gt;sum&lt;/span&gt;(d*d)]
)
  &lt;span&gt;select&lt;/span&gt; * &lt;span&gt;from&lt;/span&gt; happy;
  n  |       seen
&lt;span&gt;-----+------------------
&lt;/span&gt;   7 | {}
  49 | {49}
  97 | {49,97}
 130 | {49,97,130}
  10 | {49,97,130,10}
   1 | {49,97,130,10,1}
(6 &lt;span&gt;rows&lt;/span&gt;)

&lt;span&gt;Time&lt;/span&gt;: 1.238 ms
&lt;/pre&gt;

&lt;p&gt;That shows how it works for some &lt;em&gt;happy&lt;/em&gt; number, and it's easy to test for a
non-happy one, like for example &lt;code&gt;17&lt;/code&gt;. The query won't cycle thanks to the &lt;code&gt;seen&lt;/code&gt;
array and the &lt;code&gt;having&lt;/code&gt; filter, so the only difference between an &lt;em&gt;happy&lt;/em&gt; and a
&lt;em&gt;sad&lt;/em&gt; number will be that in the former case the last line output by the
recursive query will have &lt;code&gt;n = 1&lt;/code&gt;. Let's expand this knowledge
into a proper function (because we want to be able to have the number we
test for happiness as an argument):&lt;/p&gt;

&lt;pre class=&quot;src&quot;&gt;
&lt;span&gt;create&lt;/span&gt; &lt;span&gt;or&lt;/span&gt; replace &lt;span&gt;function&lt;/span&gt; &lt;span&gt;happy&lt;/span&gt;(x bigint)
  &lt;span&gt;returns&lt;/span&gt; &lt;span&gt;boolean&lt;/span&gt;
  &lt;span&gt;language&lt;/span&gt; &lt;span&gt;sql&lt;/span&gt;
&lt;span&gt;as&lt;/span&gt; $$
&lt;span&gt;with&lt;/span&gt; &lt;span&gt;recursive&lt;/span&gt; happy(n, seen) &lt;span&gt;as&lt;/span&gt; (
    &lt;span&gt;select&lt;/span&gt; $1, &lt;span&gt;'{}'&lt;/span&gt;::bigint[]
  &lt;span&gt;union&lt;/span&gt; &lt;span&gt;all&lt;/span&gt;
    &lt;span&gt;select&lt;/span&gt; &lt;span&gt;sum&lt;/span&gt;(d*d), h.seen || &lt;span&gt;sum&lt;/span&gt;(d*d)
      &lt;span&gt;from&lt;/span&gt; (&lt;span&gt;select&lt;/span&gt; n, digits(n) &lt;span&gt;as&lt;/span&gt; d, seen
              &lt;span&gt;from&lt;/span&gt; happy
           ) &lt;span&gt;as&lt;/span&gt; h
  &lt;span&gt;group&lt;/span&gt; &lt;span&gt;by&lt;/span&gt; h.n, h.seen
    &lt;span&gt;having&lt;/span&gt; &lt;span&gt;not&lt;/span&gt; seen @&amp;gt; &lt;span&gt;array&lt;/span&gt;[&lt;span&gt;sum&lt;/span&gt;(d*d)]
)
  &lt;span&gt;select&lt;/span&gt; n = 1 &lt;span&gt;as&lt;/span&gt; happy
    &lt;span&gt;from&lt;/span&gt; happy
&lt;span&gt;order&lt;/span&gt; &lt;span&gt;by&lt;/span&gt; array_length(seen, 1) &lt;span&gt;desc&lt;/span&gt; nulls &lt;span&gt;last&lt;/span&gt;
   &lt;span&gt;limit&lt;/span&gt; 1
$$;
&lt;/pre&gt;

&lt;p&gt;We need the &lt;code&gt;desc nulls last&lt;/code&gt; trick in the &lt;code&gt;order by&lt;/code&gt; because the &lt;code&gt;array_length()&lt;/code&gt;
of any dimension of an empty array is &lt;code&gt;NULL&lt;/code&gt;, and we certainly don't want to
return all and any number as unhappy on the grounds that the query result
contains a line &lt;code&gt;input, {}&lt;/code&gt;. Let's now play the same tricks as in the puzzle
article:&lt;/p&gt;

&lt;pre class=&quot;src&quot;&gt;
=# &lt;span&gt;select&lt;/span&gt; array_agg(x) &lt;span&gt;as&lt;/span&gt; happy &lt;span&gt;from&lt;/span&gt; generate_series(1, 50) &lt;span&gt;as&lt;/span&gt; t(x) &lt;span&gt;where&lt;/span&gt; happy(x);
              happy
&lt;span&gt;----------------------------------
&lt;/span&gt; {1,7,10,13,19,23,28,31,32,44,49}
(1 &lt;span&gt;row&lt;/span&gt;)

&lt;span&gt;Time&lt;/span&gt;: 24.527 ms

=# explain analyze &lt;span&gt;select&lt;/span&gt; x &lt;span&gt;from&lt;/span&gt; generate_series(1, 10000) &lt;span&gt;as&lt;/span&gt; t(x) &lt;span&gt;where&lt;/span&gt; happy(x);
                      QUERY PLAN
&lt;span&gt;----------------------------------------------------------------------------------------
&lt;/span&gt; &lt;span&gt;Function&lt;/span&gt; Scan &lt;span&gt;on&lt;/span&gt; generate_series t  (cost=0.00..265.00 &lt;span&gt;rows&lt;/span&gt;=333 width=4)
                          (actual &lt;span&gt;time&lt;/span&gt;=2.938..3651.019 &lt;span&gt;rows&lt;/span&gt;=1442 loops=1)
   Filter: happy((x)::bigint)
 Total runtime: 3651.534 ms
(3 &lt;span&gt;rows&lt;/span&gt;)

&lt;span&gt;Time&lt;/span&gt;: 3652.178 ms
&lt;/pre&gt;

&lt;p&gt;(Yes, I tricked the &lt;code&gt;EXPLAIN ANALYZE&lt;/code&gt; output so that it fits on the page width
here). For what it's worth, finding the first &lt;code&gt;10000&lt;/code&gt; happy numbers in &lt;em&gt;Emacs
Lisp&lt;/em&gt; on the same laptop takes &lt;code&gt;2830 ms&lt;/code&gt;, also running a recursive version of
the code.&lt;/p&gt;</content>
		<author>
			<name>Dimitri Fontaine</name>
			<uri>http://blog.tapoueh.org/blog.dim.html</uri>
		</author>
		<source>
			<title type="html">tail -f /dev/dim</title>
			<subtitle type="html">dim's PostgreSQL blog</subtitle>
			<link rel="self" href="http://blog.tapoueh.org/blog.dim.xml"/>
			<id>http://blog.tapoueh.org/blog.dim.xml</id>
			<updated>2010-08-31T12:45:46+00:00</updated>
		</source>
	</entry>

	<entry>
		<title type="html">performance issue of SQL functions</title>
		<link href="http://okbob.blogspot.com/2010/08/performance-issue-of-sql-functions.html"/>
		<id>tag:blogger.com,1999:blog-8839574367290288724.post-6689971337289081829</id>
		<updated>2010-08-30T00:38:31+00:00</updated>
		<content type="html">I though so sql functions is always faster than plpgsql function. But it's not true. Only when sql function is inlined, then function is faster, else plpgsql can be faster. Now I know, so sql functions where parameter is twice and more used are not inlined - because it means double parameter evaluation.you can see:&lt;pre&gt;&lt;br /&gt;CREATE OR REPLACE FUNCTION is_empty(text) &lt;br /&gt;RETURNS bool AS $$ &lt;br /&gt;SELECT $1 IS NULL OR $1 = '' &lt;br /&gt;$$ LANGUAGE sql;&lt;br /&gt;&lt;/pre&gt;This function returns true when parameter is empty string or is null. The first parameter is used twice and then the body of this function isn't inlined. &lt;pre&gt;&lt;br /&gt;postgres=# EXPLAIN VERBOSE SELECT count(is_empty(CASE WHEN random()  0.5 THEN NULL ELSE 'x' END)) FROM generate_series(1,100000);&lt;br /&gt;                                                 QUERY PLAN                                                 &lt;br /&gt;------------------------------------------------------------------------------------------------------------&lt;br /&gt; Aggregate  (cost=12.50..12.77 rows=1 width=0)&lt;br /&gt;   Output: count(is_empty(CASE WHEN (random()  0.5::double precision) THEN NULL::text ELSE 'x'::text END))&lt;br /&gt;   -&gt;  Function Scan on pg_catalog.generate_series  (cost=0.00..10.00 rows=1000 width=0)&lt;br /&gt;         Output: generate_series&lt;br /&gt;         Function Call: generate_series(1, 100000)&lt;br /&gt;(5 rows)&lt;br /&gt;&lt;/pre&gt;The execution time is 458ms. When I modify the body for one time paremeter using:&lt;pre&gt;&lt;br /&gt;CREATE OR REPLACE FUNCTION is_empty(text) &lt;br /&gt;RETURNS bool AS $$&lt;br /&gt;SELECT COALESCE($1,'') = '' &lt;br /&gt;$$ LANGUAGE sql;&lt;br /&gt;&lt;/pre&gt;Then function is inlined:&lt;pre&gt;&lt;br /&gt;postgres=# EXPLAIN VERBOSE SELECT count(is_empty(CASE WHEN random()  0.5 THEN NULL ELSE 'x' END)) FROM generate_series(1,100000);&lt;br /&gt;                                                            QUERY PLAN                                                             &lt;br /&gt;-----------------------------------------------------------------------------------------------------------------------------------&lt;br /&gt; Aggregate  (cost=12.50..12.52 rows=1 width=0)&lt;br /&gt;   Output: count((COALESCE(CASE WHEN (random()  0.5::double precision) THEN NULL::text ELSE 'x'::text END, ''::text) = ''::text))&lt;br /&gt;   -&gt;  Function Scan on pg_catalog.generate_series  (cost=0.00..10.00 rows=1000 width=0)&lt;br /&gt;         Output: generate_series&lt;br /&gt;         Function Call: generate_series(1, 100000)&lt;br /&gt;(5 rows)&lt;br /&gt;&lt;/pre&gt;and execution time is only 68ms (5 x faster than not inlined function).&lt;b&gt;Attention: this note is valid for some more complex parameters - like volatile functions. The life isn't simple - for basic parameters (like columns or simple expression), the most simple SQL function (in my article function with OR operator and twice used parameter) can be better - wirking better with planner.&lt;/b&gt;&lt;div class=&quot;blogger-post-footer&quot;&gt;&lt;img width=&quot;1&quot; height=&quot;1&quot; src=&quot;https://blogger.googleusercontent.com/tracker/8839574367290288724-6689971337289081829?l=okbob.blogspot.com&quot; alt=&quot;&quot; /&gt;&lt;/div&gt;</content>
		<author>
			<name>Pavel Stěhule</name>
			<email>noreply@blogger.com</email>
			<uri>http://okbob.blogspot.com/</uri>
		</author>
		<source>
			<title type="html">Pavel Stehule's blog</title>
			<subtitle type="html">Some notes about PostgreSQL</subtitle>
			<link rel="self" href="http://okbob.blogspot.com/feeds/posts/default"/>
			<id>tag:blogger.com,1999:blog-8839574367290288724</id>
			<updated>2010-09-01T21:45:54+00:00</updated>
		</source>
	</entry>

	<entry xml:lang="en">
		<title type="html">PostgreSQL Weekly News August 29th 2010</title>
		<link href="http://www.postgresql.org/community/weeklynews/pwn20100829"/>
		<id>http://www.postgresql.org/community/weeklynews/pwn20100829</id>
		<updated>2010-08-29T08:00:00+00:00</updated>
		<content type="html">PostgreSQL 9.0 RC1 out soon.  The more you test, the sooner 9.0.0 comes out!
&lt;a href=&quot;http://www.postgresql.org/developer/beta/&quot;&gt;http://www.postgresql.org/developer/beta/&lt;/a&gt;</content>
		<author>
			<name>PostgreSQL Weekly News</name>
			<uri>http://www.postgresql.org/community/weeklynews/</uri>
		</author>
		<source>
			<title type="html">PostgreSQL Weekly News</title>
			<link rel="self" href="http://wwwmaster.postgresql.org/files/weeklynews.xml"/>
			<id>http://wwwmaster.postgresql.org/files/weeklynews.xml</id>
			<updated>2010-08-30T04:15:50+00:00</updated>
		</source>
	</entry>

	<entry xml:lang="en">
		<title type="html">Online aggregation paper from 1997 and PSU&amp;#8217;s database reading group</title>
		<link href="http://www.chesnok.com/daily/2010/08/28/online-aggregation-paper-from-1997-and-psus-database-reading-grouop/"/>
		<id>http://www.chesnok.com/daily/?p=1889</id>
		<updated>2010-08-28T23:03:44+00:00</updated>
		<content type="html">&lt;p&gt;A couple weeks ago, Mark Wong and I took a field trip over to the Database Reading Group at Portland State University. It&amp;#8217;s a group of students and professors that meet weekly throughout the school year to go over research papers. The papers are picked by the participants, and vary in topic from obscure to very practical.&lt;/p&gt;
&lt;p&gt;This week&amp;#8217;s paper reading was led by Professor Len Shapiro, and titled &amp;#8220;&lt;a href=&quot;http://research.microsoft.com/en-us/um/people/helenw/papers/online.ps.gz&quot;&gt;Online Aggregation&lt;/a&gt;&amp;#8220;. The paper is considered a foundational paper about SQL aggregates (like COUNT() or AVERAGE), and was published in 1997 by researchers from UC Berkeley and IBM. It&amp;#8217;s also precursor to research into query parallelization and streaming databases. It was also awarded the SIGMOD &amp;#8220;Test of Time&amp;#8221; award in 2007, and is cited by over 170 other papers in the ACM archive.&lt;/p&gt;
&lt;p&gt;The basic idea behind the paper centered around how to improve user experience in reporting results of aggregate queries &amp;#8211; asking questions about how to solve three key problems when solving aggregates: blocking, fairness and control (from a user&amp;#8217;s perspective). Roughly: Blocking is what happens when some part of the system waits and doesn&amp;#8217;t return results to the user as a result of the waiting. Fairness concerns whether certain types of operations prevent certain groups of data from being processed (the example given had to do with GROUP BY and groups being processed one at a time). Control concerns whether or not a user can exert control over the speed of computation applied to a group (example given being a lever that &amp;#8220;speeds up&amp;#8221; processing of a set).&lt;/p&gt;
&lt;p&gt;One insight from the paper is how online aggregates should be treated differently than traditional query processing &amp;#8211; which might favor expensive plans involving sorts so that the output is ordered. When you&amp;#8217;re dealing with online aggregates, you prefer unordered, or ideally random order, because your intermediate results will be more representative of the ultimate result. I guess that&amp;#8217;s probably obvious once you think about it, but the paper provided some concrete examples.&lt;/p&gt;
&lt;p&gt;Another interesting thought experiment involving the planner is how you pick plans that favor non-blocking, fairness and user control. Each of those properties is not narrowly defined, and changes based on individual user expectation. Professor Kristen Tufte mentioned that she&amp;#8217;d be interested in how the ideas presented in this paper would be applied today, and Professor David Meier brought up that we might most be interested in applications involving managing Hadoop.&lt;/p&gt;
&lt;p&gt;Prof Meier also brought up an interesting paper involving &lt;a href=&quot;http://db.cs.berkeley.edu/papers/S2K-94-45.pdf&quot;&gt;alternating nested loop joins&lt;/a&gt; during a discussion about optimizing JOIN algorithms for online aggregates. Another cool thing about the paper is that it involved modifications to Postgres!  Granted, it was Postgres95, which doesn&amp;#8217;t resemble the modern PostgreSQL 9.0 very much. But it was nice to revisit research that used Postgres that&amp;#8217;s still relevant today.&lt;/p&gt;


&lt;p&gt;Related posts:&lt;ol&gt;&lt;li&gt;&lt;a href=&quot;http://www.chesnok.com/daily/2009/10/04/user-group-idea-the-after-party/&quot; rel=&quot;bookmark&quot; title=&quot;Permanent Link: User Group Idea: The After-party&quot;&gt;User Group Idea: The After-party&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://www.chesnok.com/daily/2009/09/18/user-group-idea-patch-review-party/&quot; rel=&quot;bookmark&quot; title=&quot;Permanent Link: User Group Idea: Patch Review Party&quot;&gt;User Group Idea: Patch Review Party&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://www.chesnok.com/daily/2008/02/01/focus-group/&quot; rel=&quot;bookmark&quot; title=&quot;Permanent Link: Women in Open Source: a focus group in March&quot;&gt;Women in Open Source: a focus group in March&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;&lt;/p&gt;</content>
		<author>
			<name>selena</name>
			<uri>http://www.chesnok.com/daily</uri>
		</author>
		<source>
			<title type="html">tending the garden</title>
			<subtitle type="html">selena marie deckelmann's blog</subtitle>
			<link rel="self" href="http://www.chesnok.com/daily/feed/atom/"/>
			<id>http://www.chesnok.com/daily/feed/atom/</id>
			<updated>2010-09-02T14:30:47+00:00</updated>
		</source>
	</entry>

	<entry xml:lang="en-us">
		<title type="html">Playing with bit strings</title>
		<link href="http://blog.tapoueh.org/blog.dim.html#%20Playing%20with%20bit%20strings"/>
		<id>http://blog.tapoueh.org/blog.dim.html#%20Playing%20with%20bit%20strings</id>
		<updated>2010-08-26T14:45:00+00:00</updated>
		<content type="html">&lt;p&gt;&lt;a name=&quot;20100826-17:45&quot; id=&quot;20100826-17:45&quot;&gt;&lt;/a&gt;
The idea of the day ain't directly from me, I'm just helping with a very
thin subpart of the problem. The problem, I can't say much about, let's just
assume you want to reduce the storage of &lt;code&gt;MD5&lt;/code&gt; in your database, so you want
to abuse &lt;a href=&quot;http://www.postgresql.org/docs/8.4/interactive/datatype-bit.html&quot;&gt;bit strings&lt;/a&gt;. A solution to use them works fine, but the datatype is
still missing some facilities, for example going from and to hexadecimal
representation in text.&lt;/p&gt;

&lt;pre class=&quot;src&quot;&gt;
&lt;span&gt;create&lt;/span&gt; &lt;span&gt;or&lt;/span&gt; replace &lt;span&gt;function&lt;/span&gt; &lt;span&gt;hex_to_varbit&lt;/span&gt;(h text)
 &lt;span&gt;returns&lt;/span&gt; varbit
 &lt;span&gt;language&lt;/span&gt; &lt;span&gt;sql&lt;/span&gt;
&lt;span&gt;as&lt;/span&gt; $$
  &lt;span&gt;select&lt;/span&gt; (&lt;span&gt;'X'&lt;/span&gt; || $1)::varbit;
$$;

&lt;span&gt;create&lt;/span&gt; &lt;span&gt;or&lt;/span&gt; replace &lt;span&gt;function&lt;/span&gt; &lt;span&gt;varbit_to_hex&lt;/span&gt;(b varbit)
 &lt;span&gt;returns&lt;/span&gt; text
 &lt;span&gt;language&lt;/span&gt; &lt;span&gt;sql&lt;/span&gt;
&lt;span&gt;as&lt;/span&gt; $$
  &lt;span&gt;select&lt;/span&gt; array_to_string(array_agg(to_hex((b &amp;lt;&amp;lt; (32*o))::&lt;span&gt;bit&lt;/span&gt;(32)::bigint)), &lt;span&gt;''&lt;/span&gt;)
    &lt;span&gt;from&lt;/span&gt; (&lt;span&gt;select&lt;/span&gt; b, generate_series(0, n-1) &lt;span&gt;as&lt;/span&gt; o
            &lt;span&gt;from&lt;/span&gt; (&lt;span&gt;select&lt;/span&gt; $1, &lt;span&gt;octet_length&lt;/span&gt;($1)/4) &lt;span&gt;as&lt;/span&gt; t(b, n)) &lt;span&gt;as&lt;/span&gt; x
$$;
&lt;/pre&gt;

&lt;p&gt;To understand the magic in the second function, let's walk through the tests
one could do when wanting to grasp how things work in the &lt;code&gt;bitstring&lt;/code&gt; world
(using also some reading of the fine documentation, too).&lt;/p&gt;

&lt;pre class=&quot;src&quot;&gt;
=# select ('101011001011100110010110'::varbit &amp;lt;&amp;lt; 0)::bit(8);
   bit
----------
 10101100
(1 row)

=# select ('101011001011100110010110'::varbit &amp;lt;&amp;lt; 8)::bit(8);
   bit
----------
 10111001
(1 row)

=# select ('101011001011100110010110'::varbit &amp;lt;&amp;lt; 16)::bit(8);
   bit
----------
 10010110
(1 row)

=# select * from *TEMP VERSION OF THE FUNCTION FOR TESTING*
 o |                b                 |    x
---+----------------------------------+----------
 0 | 10101100101111010001100011011011 | acbd18db
 1 | 01001100110000101111100001011100 | 4cc2f85c
 2 | 11101101111011110110010101001111 | edef654f
 3 | 11001100110001001010010011011000 | ccc4a4d8
(4 rows)
&lt;/pre&gt;

&lt;p&gt;What do we get from that, will you ask? Let's see a little example:&lt;/p&gt;

&lt;pre class=&quot;src&quot;&gt;
=# select hex_to_varbit(md5('foo'));
                                                          hex_to_varbit
----------------------------------------------------------------------------------------------------------------------------------
 10101100101111010001100011011011010011001100001011111000010111001110110111101111011001010100111111001100110001001010010011011000
(1 row)

=# select md5('foo'), varbit_to_hex(hex_to_varbit(md5('foo')));
               md5                |          varbit_to_hex
----------------------------------+----------------------------------
 acbd18db4cc2f85cedef654fccc4a4d8 | acbd18db4cc2f85cedef654fccc4a4d8
(1 row)
&lt;/pre&gt;

&lt;p&gt;Storing &lt;code&gt;varbits&lt;/code&gt; rather than the &lt;code&gt;text&lt;/code&gt; form of the &lt;code&gt;MD5&lt;/code&gt; allows us to go from
&lt;code&gt;6510 MB&lt;/code&gt; down to &lt;code&gt;4976 MB&lt;/code&gt; on a sample table containing 100 millions
rows. We're targeting more that that, so that's a great win down here!&lt;/p&gt;

&lt;p&gt;In case you wonder, querying the main index on &lt;code&gt;varbit&lt;/code&gt; rather than the one on
&lt;code&gt;text&lt;/code&gt; for a single result row, the cost of doing the conversion with
&lt;code&gt;varbit_to_hex&lt;/code&gt; seems to be around &lt;code&gt;28 µs&lt;/code&gt;. We can afford it.&lt;/p&gt;

&lt;p&gt;Hope this helps!&lt;/p&gt;</content>
		<author>
			<name>Dimitri Fontaine</name>
			<uri>http://blog.tapoueh.org/blog.dim.html</uri>
		</author>
		<source>
			<title type="html">tail -f /dev/dim</title>
			<subtitle type="html">dim's PostgreSQL blog</subtitle>
			<link rel="self" href="http://blog.tapoueh.org/blog.dim.xml"/>
			<id>http://blog.tapoueh.org/blog.dim.xml</id>
			<updated>2010-08-31T12:45:46+00:00</updated>
		</source>
	</entry>

	<entry xml:lang="en">
		<title type="html">Explain Plans PostgreSQL 9.0 - Part 2: JSON and JQuery Plan Viewer</title>
		<link href="http://www.postgresonline.com/journal/archives/174-Explain-Plans-PostgreSQL-9.0-Part-2-JSON-and-JQuery-Plan-Viewer.html"/>
		<id>http://www.postgresonline.com/journal/archives/174-guid.html</id>
		<updated>2010-08-26T08:13:00+00:00</updated>
		<content type="html">&lt;p&gt;In &lt;a href=&quot;http://www.postgresonline.com/journal/archives/171-pgexplain90formats_part1.html&quot; target=&quot;_blank&quot;&gt;part 1 of this series&lt;/a&gt; on PostgreSQL 9.0 planner outputs, we demonstrated how to render explain plans in YAML, JSON, and XML using the new explain features in PostgreSQL 9.0. In this second part,
we'll demonstrate how to build a user interface that allows you input a JSON formatted explain plan and have it render into a printable, navigateable display using JQuery, javascript and a little bit of HTML coding.  
In part 3 we'll do something similar using XML and XSLT programming.
&lt;/p&gt;
&lt;p&gt;For those who aren't familiar with JQuery, it is an MIT licensed javascript library that is fairly light weight and allows you to inspect and change html elements with fairly intuitive syntax, has some nice ajax methods and tools for converting xml/json to native objects that can be manipulated. 
You can check it out at &lt;a href=&quot;http://jquery.com/&quot; target=&quot;_blank&quot;&gt;JQUERY&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;We are not experts in JQuery, but from what we have used of it, we really like it and the fact the base package is MIT licensed, fairly light weight and lots of plugins available for it are real pluses.&lt;/p&gt;


&lt;p&gt;The most difficult thing I think most people find about reading explain plans is that they are upside down; it starts with a conclusion and backtracks how to arrive at it.  Humans by nature think about planning steps from start to finish.
In order to make an explain plan understandable to mere mortals, we generally display them upside down or having the child-nodes shown left most.  We shall follow that approach.&lt;/p&gt;
 &lt;br /&gt;&lt;a href=&quot;http://www.postgresonline.com/journal/archives/174-Explain-Plans-PostgreSQL-9.0-Part-2-JSON-and-JQuery-Plan-Viewer.html#extended&quot;&gt;Continue reading &quot;Explain Plans PostgreSQL 9.0 - Part 2: JSON and JQuery Plan Viewer&quot;&lt;/a&gt;</content>
		<author>
			<name>Leo Hsu and Regina Obe</name>
			<email>nospam@example.com</email>
			<uri>http://www.postgresonline.com/journal/</uri>
		</author>
		<source>
			<title type="html">Postgres OnLine Journal</title>
			<subtitle type="html">an In depth look at the PostgreSQL open source database</subtitle>
			<link rel="self" href="http://www.postgresonline.com/journal/index.php?/feeds/index.rss2"/>
			<id>http://www.postgresonline.com/journal/index.php?/feeds/index.rss2</id>
			<updated>2010-08-29T17:15:10+00:00</updated>
		</source>
	</entry>

	<entry>
		<title type="html">PgWest: 2010 Call for Papers (2nd call)</title>
		<link href="http://www.commandprompt.com/blogs/joshua_drake/2010/08/pgwest_2010_call_for_papers_2nd_call/"/>
		<id>http://www.commandprompt.com/blogs/joshua_drake/2010/08/pgwest_2010_call_for_papers_2nd_call/</id>
		<updated>2010-08-25T19:14:10+00:00</updated>
		<content type="html">Yes, it is the second call. That means some of you haven't submitted after the first call. Of course, I haven't submitted mine either; so it is time for everyone to get on it. West is just around the corner and from all observations this West stands to be the largest PostgreSQL Conference, ever. (O.k. we might not over take Brazil).&lt;p&gt;Here is the announcement for everyone to review, enjoy and click on the CFP link:&lt;p&gt;Following on the smashing success of PostgreSQL Conference East, PostgreSQL Conference West, The PostgreSQL Conference for Decision Makers, End Users and Developers, is being held at the Sir Francis Drake Hotel in San Francisco from November 2nd through 4th 2010. Please join us in making this the largest PostgreSQL Conference to date!&lt;p&gt;&lt;li&gt;&lt;a href=&quot;http://www.postgresqlconference.org/&quot;&gt;Main conference site&lt;/a&gt;
&lt;li&gt;&lt;a href=&quot;http://www.postgresqlconference.org/2010/west/cfp&quot;&gt;Call for Papers&lt;/a&gt;
&lt;p&gt;&lt;strong&gt;Thank you to our sponsors:&lt;/strong&gt;
Founding: &lt;a href=&quot;http://www.commandprompt.com/&quot;&gt;Command Prompt&lt;/a&gt;
Diamond: &lt;a href=&quot;http://www.enterprisedb.com/&quot;&gt;EnterpriseDB&lt;/a&gt;
&lt;p&gt;&lt;strong&gt;Time line:&lt;/strong&gt;&lt;blockquote&gt;July 14th: Talk submission opens
        Sept 5th: Talk submission closes
        Sept 10th: Speaker notification
        &lt;/blockquote&gt;This year we will be continuing our trend of covering the entire
PostgreSQL ecosystem. We would like to see talks and tutorials on the
following topics:&lt;p&gt;&lt;pre&gt;
      * General PostgreSQL: 
              * Administration 
              * Performance 
              * High Availability 
              * Migration 
              * GIS 
              * Integration 
              * Solutions and White Papers 
      * The Stack: 
              * Python/Django/Pylons/TurboGears/Custom 
              * Perl5/Catalyst/Bricolage 
              * Ruby/Rails 
              * Java (PLJava would be great)/Groovy/Grails 
              * Operating System optimization
                (Linux/FBSD/Solaris/Windows) 
              * Solutions and White Papers 
&lt;/pre&gt;&lt;/p&gt;&lt;/p&gt;&lt;/p&gt;&lt;/li&gt;&lt;/li&gt;&lt;/p&gt;&lt;/p&gt;&lt;/p&gt;</content>
		<author>
			<name>Joshua D. Drake</name>
			<uri>http://www.commandprompt.com/blogs/joshua_drake/</uri>
		</author>
		<source>
			<title type="html">CMD: Joshua Drake's Blog</title>
			<subtitle type="html">Command Prompt Blog Feed: Joshua Drake's Blog</subtitle>
			<link rel="self" href="http://www.commandprompt.com/rss/blogs/joshua_drake"/>
			<id>http://www.commandprompt.com/rss/blogs/joshua_drake</id>
			<updated>2010-09-02T14:30:26+00:00</updated>
		</source>
	</entry>

	<entry xml:lang="en">
		<title type="html">Waiting for 9.1 – concat, concat_ws, right, left, reverse</title>
		<link href="http://www.depesz.com/index.php/2010/08/24/waiting-for-9-1-concat-concat_ws-right-left-reverse/"/>
		<id>http://www.depesz.com/?p=1820</id>
		<updated>2010-08-24T11:59:20+00:00</updated>
		<content type="html">On 24th of August, Takahiro Itagaki committed patch: Log Message: ----------- Add string functions: concat(), concat_ws(), left(), right(), and reverse(). &amp;#160; Pavel Stehule, reviewed by me. What are these functions? concat() is just functional counterpart to &amp;#124;&amp;#124; operator, with the ability to handle many strings at the same time: $ SELECT concat&amp;#40; 'post', 'gres', 'ql' [...]</content>
		<author>
			<name>Hubert Lubaczewski</name>
			<uri>http://www.depesz.com</uri>
		</author>
		<source>
			<title type="html">select * from depesz; » postgresql</title>
			<link rel="self" href="http://www.depesz.com/index.php/tag/postgresql/feed/"/>
			<id>http://www.depesz.com/index.php/tag/postgresql/feed/</id>
			<updated>2010-08-30T12:16:45+00:00</updated>
		</source>
	</entry>

	<entry xml:lang="en">
		<title type="html">Adding enums</title>
		<link href="http://people.planetpostgresql.org/andrew/index.php?/archives/101-Adding-enums.html"/>
		<id>http://people.planetpostgresql.org/andrew/index.php?/archives/101-guid.html</id>
		<updated>2010-08-23T21:06:42+00:00</updated>
		<content type="html">While on a 15 hour plane trip from LA to Sydney the other day I broke the back of making enums extensible, thus proving that there is some good to be had from both long plane flights and tiny netbooks.&lt;br /&gt;
&lt;br /&gt;
I posted a work in progress patch on the -hackers list yesterday. In it current form, it will allow you to do these things:&lt;br /&gt;
&lt;ul&gt;&lt;br /&gt;
&lt;li&gt;ALTER TYPE myenum ADD 'newlabel';&lt;/li&gt;&lt;br /&gt;
&lt;li&gt;ALTER TYPE myenum ADD 'newlabel' BEFORE 'existinglabel';&lt;/li&gt;&lt;br /&gt;
&lt;li&gt;ALTER TYPE myenum ADD 'newlabel' AFTER 'existinglabel';&lt;/li&gt;&lt;br /&gt;
&lt;/ul&gt;&lt;br /&gt;
The last one is not strictly necessary, and there is some opinion both for and against having it.&lt;br /&gt;
&lt;br /&gt;
If labels are added at the end of the list (the first form does this) then, unless there is Oid wraparound, the enum Oids are in sorted order, which makes sorting and comparison operations very fast, as now. Labels added earlier in the list will sort and compare correctly, but not quite as fast.&lt;br /&gt;
&lt;br /&gt;
Note that I have not provided for dropping existing labels, nor for changing the sort order of existing labels. The reason is that this would involve rewriting tables and indexes, where the current proposal will not require any such thing.</content>
		<author>
			<name>Andrew Dunstan</name>
			<email>nospam@example.com</email>
			<uri>http://people.planetpostgresql.org/andrew/</uri>
		</author>
		<source>
			<title type="html">Andrew's PostgreSQL blog</title>
			<subtitle type="html">My little place on the web...</subtitle>
			<link rel="self" href="http://people.planetpostgresql.org/andrew/index.php?/feeds/index.rss2"/>
			<id>http://people.planetpostgresql.org/andrew/index.php?/feeds/index.rss2</id>
			<updated>2010-08-23T21:45:28+00:00</updated>
		</source>
	</entry>

	<entry>
		<title type="html">Npgsql receives donation of an MSDN subscription!!</title>
		<link href="http://fxjr.blogspot.com/2010/08/npgsql-receives-donation-of-msdn.html"/>
		<id>tag:blogger.com,1999:blog-15237920.post-8867856927180959840</id>
		<updated>2010-08-23T20:10:38+00:00</updated>
		<content type="html">Hi all!&lt;br /&gt;&lt;br /&gt;It all started when Josh Cooley told me about this post:&amp;nbsp; &lt;a href=&quot;http://devlicio.us/blogs/tuna_toksoz/archive/2010/07/27/codebetter-devlicio-us-msdn-ultimate-giveaways.aspx&quot;&gt;http://devlicio.us/blogs/tuna_toksoz/archive/2010/07/27/codebetter-devlicio-us-msdn-ultimate-giveaways.aspx&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;I sent a mail talking about Npgsql and how a VS.Net would help us to add design time support and today I received a very nice mail saying that Npgsql was choosen to receive an MSDN subscription!&lt;br /&gt;&lt;br /&gt;I'd like to thank the people who contributed to make this possible: &lt;b&gt;Codebetter Crew&lt;/b&gt;: &lt;a href=&quot;http://codebetter.com/blogs/benhall&quot; target=&quot;_blank&quot;&gt;Ben Hall&lt;/a&gt;, &lt;a href=&quot;http://codebetter.com/blogs/wardbell/&quot; target=&quot;_blank&quot;&gt;Ward Bell&lt;/a&gt;, &lt;a href=&quot;http://codebetter.com/blogs/james.kovacs&quot; target=&quot;_blank&quot;&gt;James Kovacs&lt;/a&gt;. &lt;b&gt;Devlicious Crew&lt;/b&gt;: &lt;a href=&quot;http://devlicio.us/blogs/hadi_hariri&quot; target=&quot;_blank&quot;&gt;Hadi Hariri&lt;/a&gt;, &lt;a href=&quot;http://devlicio.us/blogs/christopher_bennage&quot; target=&quot;_blank&quot;&gt;Christopher Bennage&lt;/a&gt;, &lt;a href=&quot;http://devlicio.us/blogs/tim_barcz&quot; target=&quot;_blank&quot;&gt;Tim Barcz&lt;/a&gt;, &lt;a href=&quot;http://devlicious.com/blogs/rob_reynolds/&quot; target=&quot;_blank&quot;&gt;Rob Reynolds&lt;/a&gt;.&amp;nbsp; &lt;b&gt;Lostechies Crew&lt;/b&gt;: &lt;a href=&quot;http://www.lostechies.com/blogs/hex/&quot; target=&quot;_blank&quot;&gt;Eric Hexter&lt;/a&gt;, &lt;a href=&quot;http://www.lostechies.com/blogs/jimmy_bogard/default.aspx&quot; target=&quot;_blank&quot;&gt;Jimmy Bogard&lt;/a&gt;, &lt;a href=&quot;http://www.lostechies.com/blogs/dahlbyk/&quot; target=&quot;_blank&quot;&gt;Keith Dahlby&lt;/a&gt; and Josh Cooley for heads up!&lt;br /&gt;&lt;br /&gt;Thank you very much! Your support to OSS projects is awesome!&lt;br /&gt;&lt;br /&gt;And stay tuned for better support of Npgsql inside VS.Net :)&lt;div class=&quot;blogger-post-footer&quot;&gt;&lt;img width=&quot;1&quot; height=&quot;1&quot; src=&quot;https://blogger.googleusercontent.com/tracker/15237920-8867856927180959840?l=fxjr.blogspot.com&quot; alt=&quot;&quot; /&gt;&lt;/div&gt;</content>
		<author>
			<name>Francisco Figueiredo Jr.</name>
			<email>noreply@blogger.com</email>
			<uri>http://fxjr.blogspot.com/</uri>
		</author>
		<source>
			<title type="html">Francisco Figueiredo Jr Activities</title>
			<subtitle type="html">On this blog I will post info about myself and the development projects I participate like Npgsql and Mono.
Check out my other blog about Android: http://franciscodroid.blogspot.com</subtitle>
			<link rel="self" href="http://fxjr.blogspot.com/atom.xml"/>
			<id>tag:blogger.com,1999:blog-15237920</id>
			<updated>2010-08-28T17:45:51+00:00</updated>
		</source>
	</entry>

	<entry xml:lang="en">
		<title type="html">How to manage changes to your database?</title>
		<link href="http://www.depesz.com/index.php/2010/08/22/versioning/"/>
		<id>http://www.depesz.com/?p=1814</id>
		<updated>2010-08-22T14:39:49+00:00</updated>
		<content type="html">Every now and then somebody asks how to make diff of database schemata. Usual background is like: we have production database, and development database, and we want to see what is different on development to be able to change production in the same way. Personally I think that such approach is inherently flawed. Why? First [...]</content>
		<author>
			<name>Hubert Lubaczewski</name>
			<uri>http://www.depesz.com</uri>
		</author>
		<source>
			<title type="html">select * from depesz; » postgresql</title>
			<link rel="self" href="http://www.depesz.com/index.php/tag/postgresql/feed/"/>
			<id>http://www.depesz.com/index.php/tag/postgresql/feed/</id>
			<updated>2010-08-30T12:16:45+00:00</updated>
		</source>
	</entry>

	<entry xml:lang="en">
		<title type="html">PostgreSQL Weekly News August 22nd 2010</title>
		<link href="http://www.postgresql.org/community/weeklynews/pwn20100822"/>
		<id>http://www.postgresql.org/community/weeklynews/pwn20100822</id>
		<updated>2010-08-22T08:00:00+00:00</updated>
		<content type="html">Call for Papers for PGDay.EU 2010 held on December 6-8 in Stuttgart,
Germany is open.
&lt;a href=&quot;http://2010.pgday.eu/callforpapers&quot;&gt;http://2010.pgday.eu/callforpapers&lt;/a&gt;</content>
		<author>
			<name>PostgreSQL Weekly News</name>
			<uri>http://www.postgresql.org/community/weeklynews/</uri>
		</author>
		<source>
			<title type="html">PostgreSQL Weekly News</title>
			<link rel="self" href="http://wwwmaster.postgresql.org/files/weeklynews.xml"/>
			<id>http://wwwmaster.postgresql.org/files/weeklynews.xml</id>
			<updated>2010-08-30T04:15:50+00:00</updated>
		</source>
	</entry>

	<entry xml:lang="en">
		<title type="html">Using LTree to Represent and Query Hierarchy and Tree Structures</title>
		<link href="http://www.postgresonline.com/journal/archives/173-Using-LTree-to-Represent-and-Query-Hierarchy-and-Tree-Structures.html"/>
		<id>http://www.postgresonline.com/journal/archives/173-guid.html</id>
		<updated>2010-08-22T05:15:00+00:00</updated>
		<content type="html">&lt;p&gt;PostgreSQL offers several options for displaying and querying tree like structures.  
In &lt;a href=&quot;http://www.postgresonline.com/journal/archives/131-Using-Recursive-Common-table-expressions-to-represent-Tree-structures.html&quot; target=&quot;_blank&quot;&gt;Using Recursive Common Table Expressions (CTE) to represent tree structures&lt;/a&gt;
we demonstrated how to use common table expressions to display a tree like structure.  Common Table Expressions required PostgreSQL 8.4 and above but  was fairly ANSI standards compliant. In addition to that 
approach you have the option of using recursive functions.  There is yet another common approach for this which is specific to PostgreSQL.  This is using the &lt;a href=&quot;http://www.postgresql.org/docs/current/static/ltree.html&quot; target=&quot;_blank&quot;&gt;ltree contrib datatype&lt;/a&gt;
that has been supported for sometime in PostgreSQL.  For one of our recent projects, we chose ltree over the other approaches because the performance is much better when you need to do ad-hoc queries over the tree since it can take advantage of btree and gist indexes
and also has built-in tree query expressions that make ad-hoc queries simpler to do; similar in concept to the tsearch query syntax for querying text. &lt;/p&gt;

&lt;p&gt;In this article we'll demonstrate how to use ltree and along the way also show the PostgreSQL 9.0 new features &lt;b&gt;conditional triggers&lt;/b&gt; and &lt;b&gt;ordered aggregates&lt;/b&gt;.&lt;/p&gt;
 &lt;br /&gt;&lt;a href=&quot;http://www.postgresonline.com/journal/archives/173-Using-LTree-to-Represent-and-Query-Hierarchy-and-Tree-Structures.html#extended&quot;&gt;Continue reading &quot;Using LTree to Represent and Query Hierarchy and Tree Structures&quot;&lt;/a&gt;</content>
		<author>
			<name>Leo Hsu and Regina Obe</name>
			<email>nospam@example.com</email>
			<uri>http://www.postgresonline.com/journal/</uri>
		</author>
		<source>
			<title type="html">Postgres OnLine Journal</title>
			<subtitle type="html">an In depth look at the PostgreSQL open source database</subtitle>
			<link rel="self" href="http://www.postgresonline.com/journal/index.php?/feeds/index.rss2"/>
			<id>http://www.postgresonline.com/journal/index.php?/feeds/index.rss2</id>
			<updated>2010-08-29T17:15:10+00:00</updated>
		</source>
	</entry>

	<entry xml:lang="en">
		<title type="html">OmniPITR – hot backup on slave</title>
		<link href="http://www.depesz.com/index.php/2010/08/18/omnipitr-hot-backup-on-slave/"/>
		<id>http://www.depesz.com/?p=1810</id>
		<updated>2010-08-18T12:36:52+00:00</updated>
		<content type="html">Well, the biggest information is that hot-backups on slave work. And they work fine. Really fine. Some more information (with nice graph!): Background: hot backup is backup of database server, done with backing up data files, and not issuing pg_dump. There are certain benefits of doing it &amp;#8211; for example the fact that if you&amp;#8217;d [...]</content>
		<author>
			<name>Hubert Lubaczewski</name>
			<uri>http://www.depesz.com</uri>
		</author>
		<source>
			<title type="html">select * from depesz; » postgresql</title>
			<link rel="self" href="http://www.depesz.com/index.php/tag/postgresql/feed/"/>
			<id>http://www.depesz.com/index.php/tag/postgresql/feed/</id>
			<updated>2010-08-30T12:16:45+00:00</updated>
		</source>
	</entry>

	<entry>
		<title type="html">New Android Blog</title>
		<link href="http://fxjr.blogspot.com/2010/08/new-android-blog.html"/>
		<id>tag:blogger.com,1999:blog-15237920.post-7597401028186644767</id>
		<updated>2010-08-17T20:40:56+00:00</updated>
		<content type="html">&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Hi all!&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;I've been playing with Android for quite some time now and so I decided to create a blog where I'll talk about my experience with the platform and the projects I'm developing for it.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;The blog page is: &lt;a href=&quot;http://franciscodroid.blogspot.com/&quot;&gt;http://franciscodroid.blogspot.com&lt;/a&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;I invite you all who are interested in the platform to have a look at it. &lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;This blog will continue to be about Npgsql, Mono and other relevant things. I decided to create another blog so I could concentrate posts about Android there.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Feedback, as always, is very welcome.&lt;/div&gt;&lt;div class=&quot;blogger-post-footer&quot;&gt;&lt;img width=&quot;1&quot; height=&quot;1&quot; src=&quot;https://blogger.googleusercontent.com/tracker/15237920-7597401028186644767?l=fxjr.blogspot.com&quot; alt=&quot;&quot; /&gt;&lt;/div&gt;</content>
		<author>
			<name>Francisco Figueiredo Jr.</name>
			<email>noreply@blogger.com</email>
			<uri>http://fxjr.blogspot.com/</uri>
		</author>
		<source>
			<title type="html">Francisco Figueiredo Jr Activities</title>
			<subtitle type="html">On this blog I will post info about myself and the development projects I participate like Npgsql and Mono.
Check out my other blog about Android: http://franciscodroid.blogspot.com</subtitle>
			<link rel="self" href="http://fxjr.blogspot.com/atom.xml"/>
			<id>tag:blogger.com,1999:blog-15237920</id>
			<updated>2010-08-28T17:45:51+00:00</updated>
		</source>
	</entry>

	<entry>
		<title type="html">divide a table into a partitions</title>
		<link href="http://okbob.blogspot.com/2010/08/divide-table-into-partitions.html"/>
		<id>tag:blogger.com,1999:blog-8839574367290288724.post-2195599527916422380</id>
		<updated>2010-08-17T05:59:37+00:00</updated>
		<content type="html">HelloI had to verify a speed of two methods of dividing data to partion. First method is based on dynamic SQL, second is based on cursor scan and prepared statements. I was surprised - both variants has a same speed.&lt;pre&gt;&lt;br /&gt;CREATE OR REPLACE FUNCTION public.foo()&lt;br /&gt; RETURNS void&lt;br /&gt; LANGUAGE plpgsql&lt;br /&gt;AS $function$&lt;br /&gt;BEGIN&lt;br /&gt;  FOR i IN 0..9&lt;br /&gt;  LOOP&lt;br /&gt;    RAISE NOTICE '***** % *****', i;&lt;br /&gt;    EXECUTE 'TRUNCATE TABLE ' || ('x' || i)::regclass;&lt;br /&gt;    EXECUTE 'INSERT INTO ' || ('x' || i)::regclass ||&lt;br /&gt;                ' SELECT * FROM x WHERE a &gt;= $1 AND a  $1 + 100000'&lt;br /&gt;       USING i * 100000;&lt;br /&gt;  END LOOP;&lt;br /&gt;  RETURN;&lt;br /&gt;END;&lt;br /&gt;$function$&lt;br /&gt;&lt;/pre&gt;This variant is shorter, but needs a active index on source table.&lt;pre&gt;&lt;br /&gt;CREATE OR REPLACE FUNCTION public.foo1()&lt;br /&gt; RETURNS void&lt;br /&gt; LANGUAGE plpgsql&lt;br /&gt;AS $function$&lt;br /&gt;DECLARE&lt;br /&gt;  c CURSOR FOR SELECT * FROM x;&lt;br /&gt;  r RECORD;&lt;br /&gt;BEGIN&lt;br /&gt;  TRUNCATE TABLE x0;&lt;br /&gt;  TRUNCATE TABLE x1;&lt;br /&gt;  TRUNCATE TABLE x2;&lt;br /&gt;  TRUNCATE TABLE x3;&lt;br /&gt;  TRUNCATE TABLE x4;&lt;br /&gt;  TRUNCATE TABLE x5;&lt;br /&gt;  TRUNCATE TABLE x6;&lt;br /&gt;  TRUNCATE TABLE x7;&lt;br /&gt;  TRUNCATE TABLE x8;&lt;br /&gt;  TRUNCATE TABLE x9;&lt;br /&gt;&lt;br /&gt;  FOR r IN c&lt;br /&gt;  LOOP&lt;br /&gt;    CASE&lt;br /&gt;        WHEN r.a BETWEEN 0 AND 99999 THEN&lt;br /&gt;            INSERT INTO x0 VALUES(r.a);&lt;br /&gt;        WHEN r.a BETWEEN 100000 AND 199999 THEN&lt;br /&gt;            INSERT INTO x1 VALUES(r.a);&lt;br /&gt;        WHEN r.a BETWEEN 200000 AND 299999 THEN&lt;br /&gt;            INSERT INTO x2 VALUES(r.a);&lt;br /&gt;        WHEN r.a BETWEEN 300000 AND 399999 THEN&lt;br /&gt;            INSERT INTO x3 VALUES(r.a);&lt;br /&gt;        WHEN r.a BETWEEN 400000 AND 499999 THEN&lt;br /&gt;            INSERT INTO x4 VALUES(r.a);&lt;br /&gt;        WHEN r.a BETWEEN 500000 AND 599999 THEN&lt;br /&gt;            INSERT INTO x5 VALUES(r.a);&lt;br /&gt;        WHEN r.a BETWEEN 600000 AND 699999 THEN&lt;br /&gt;            INSERT INTO x6 VALUES(r.a);&lt;br /&gt;        WHEN r.a BETWEEN 700000 AND 799999 THEN&lt;br /&gt;            INSERT INTO x7 VALUES(r.a);&lt;br /&gt;        WHEN r.a BETWEEN 800000 AND 899999 THEN&lt;br /&gt;            INSERT INTO x8 VALUES(r.a);&lt;br /&gt;        WHEN r.a BETWEEN 900000 AND 1000000 THEN&lt;br /&gt;            INSERT INTO x9 VALUES(r.a);&lt;br /&gt;    END CASE;&lt;br /&gt;  END LOOP;&lt;br /&gt;END;&lt;br /&gt;$function$&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;This variant is longer, but doesn't need a active index on source table.&lt;div class=&quot;blogger-post-footer&quot;&gt;&lt;img width=&quot;1&quot; height=&quot;1&quot; src=&quot;https://blogger.googleusercontent.com/tracker/8839574367290288724-2195599527916422380?l=okbob.blogspot.com&quot; alt=&quot;&quot; /&gt;&lt;/div&gt;</content>
		<author>
			<name>Pavel Stěhule</name>
			<email>noreply@blogger.com</email>
			<uri>http://okbob.blogspot.com/</uri>
		</author>
		<source>
			<title type="html">Pavel Stehule's blog</title>
			<subtitle type="html">Some notes about PostgreSQL</subtitle>
			<link rel="self" href="http://okbob.blogspot.com/feeds/posts/default"/>
			<id>tag:blogger.com,1999:blog-8839574367290288724</id>
			<updated>2010-09-01T21:45:54+00:00</updated>
		</source>
	</entry>

	<entry xml:lang="fr">
		<title type="html">pgAdmin GSoC: Database Designer</title>
		<link href="http://blog.guillaume.lelarge.info/index.php/post/2010/08/16/pgAdmin-GSoC%3A-Database-Designer"/>
		<id>urn:md5:73a32b6fb58d12f93469c2bcdcc3dcae</id>
		<updated>2010-08-16T21:47:00+00:00</updated>
		<content type="html">&lt;p&gt;Luis Ochoa just finished his &lt;a href=&quot;http://code.google.com/intl/en/soc/&quot; hreflang=&quot;en&quot;&gt;GSoC&lt;/a&gt;. I really think it is a great success. Wanna get a look at it? just watch this nice &lt;a href=&quot;http://www.youtube.com/watch?v=RbXIuyTIpJ0&quot; hreflang=&quot;en&quot;&gt;video&lt;/a&gt;.&lt;/p&gt;


&lt;p&gt;Unfortunately, I can't commit it right away. There is still work to do. First, I want to read all the code. I know most of it, but I need to get a deeper understanding. Then, the UI needs a lot of work, as &lt;a href=&quot;http://archives.postgresql.org/pgadmin-hackers/2010-08/msg00052.php&quot; hreflang=&quot;en&quot;&gt;Thom Brown already said&lt;/a&gt; on the &lt;a href=&quot;http://archives.postgresql.org/pgadmin-hackers/&quot; hreflang=&quot;en&quot;&gt;pgAdmin hackers list&lt;/a&gt;.&lt;/p&gt;


&lt;p&gt;The first thing we need to decide is how to work together. I want Luis to continue his work if he wants too. As pgAdmin is now using &lt;a href=&quot;http://www.pgadmin.org/development/git.php&quot; hreflang=&quot;en&quot;&gt;Git&lt;/a&gt; as its main source code repository, we could probably create a gsoc_dd branch where I could put Luis's current work and where Luis and I can work together to enhance it. Then, when it's ready, we'll merge this branch with the master. Need to get &lt;a href=&quot;http://pgsnake.blogspot.com/&quot; hreflang=&quot;en&quot;&gt;Dave&lt;/a&gt;'s opinion on this. And I'm still wondering what we should do with the branch once we merged it.&lt;/p&gt;


&lt;p&gt;Anyway, even if there's still work to do, it's really exciting. It could be the major new feature for pgAdmin 1.14. And not the only one. There's also the other GSoC project for pgAdmin. Unfortunately I don't have a video link for this one, I didn't even see it live. Just hope for the best. There will be other major features, in the server status window and in the query tool (EXPLAIN XML, I need to find time to work on this one). Yeah, this is really exciting.&lt;/p&gt;</content>
		<author>
			<name>Guillaume Lelarge</name>
			<uri>http://blog.guillaume.lelarge.info/index.php/</uri>
		</author>
		<source>
			<title type="html">gleu's blog - PlanetPostgreSQL</title>
			<link rel="self" href="http://blog.guillaume.lelarge.info/index.php/feed/category/Planetpostgresql/rss2"/>
			<id>http://blog.guillaume.lelarge.info/index.php/feed/category/Planetpostgresql/rss2</id>
			<updated>2010-08-31T22:15:57+00:00</updated>
		</source>
	</entry>

	<entry xml:lang="en">
		<title type="html">Sponsoring PGXN</title>
		<link href="http://www.postgresql.us/node/117"/>
		<id>http://www.postgresql.us/117 at http://www.postgresql.us</id>
		<updated>2010-08-16T15:58:08+00:00</updated>
		<content type="html">&lt;p&gt;JD Wrote:&lt;/p&gt;
&lt;p&gt;We are pleased to announce that the PgUS Board has decided to sponsor &lt;a href=&quot;http://www.pgxn.org&quot;&gt;PGXN&lt;/a&gt;. For those who don't know what PGXN is, from the website:&lt;/p&gt;
&lt;blockquote&gt;&lt;p&gt;
PGXN, the PostgreSQL Extension network, is a central distribution system for open-source PostgreSQL extension libraries. In its first iteration it will consist of four basic parts:&lt;/p&gt;
&lt;li&gt;An upload and distribution infrastructure for extension developers.
&lt;li&gt;A centralized index and API of distribution metadata.
&lt;li&gt;A website for searching extensions and perusing their documentation.&lt;br /&gt;
&lt;p&gt;&lt;a href=&quot;http://www.postgresql.us/node/117&quot;&gt;read more&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;&lt;/li&gt;&lt;/li&gt;&lt;/blockquote&gt;</content>
		<author>
			<name>US PostgreSQL Association</name>
			<uri>http://www.postgresql.us</uri>
		</author>
		<source>
			<title type="html">United States PostgreSQL Association</title>
			<link rel="self" href="http://www.postgresql.us/rss.xml"/>
			<id>http://www.postgresql.us/rss.xml</id>
			<updated>2010-09-02T14:30:21+00:00</updated>
		</source>
	</entry>

	<entry xml:lang="en">
		<title type="html">Now What? (wrt OpenSolaris and your database)</title>
		<link href="http://www.xzilla.net/blog/2010/Aug/Now-What-wrt-OpenSolaris-and-your-database.html"/>
		<id>http://www.xzilla.net/blog/2010/Aug/492.html</id>
		<updated>2010-08-16T13:45:11+00:00</updated>
		<content type="html">Last week's &quot;announcement&quot; of the &lt;a href=&quot;http://www.xzilla.net/exit.php?url_id=467&amp;amp;entry_id=492&quot; title=&quot;http://mail.OpenSolaris.org/pipermail/opensolaris-discuss/2010-August/059310.html&quot;&gt;death of OpenSolaris&lt;/a&gt; has steered a lot of questions my way about where people should go, and/or where &lt;a href=&quot;http://www.xzilla.net/exit.php?url_id=462&amp;amp;entry_id=492&quot; title=&quot;http://www.omniti.com/&quot;&gt;OmniTI&lt;/a&gt; will go, now that OpenSolaris future looks non-existent. As one of the more &lt;a href=&quot;http://www.xzilla.net/exit.php?url_id=463&amp;amp;entry_id=492&quot; title=&quot;http://omniti.com/presents/postgresql-on-solaris&quot;&gt;open users&lt;/a&gt; of Solaris related technology, and running some &lt;a href=&quot;http://www.xzilla.net/exit.php?url_id=464&amp;amp;entry_id=492&quot; title=&quot;http://omniti.com/remembers/2008/theo-schlossnagle-talks-with-sun&quot;&gt;beefy loads&lt;/a&gt; on top of it, it makes sense that people would be curious as to what we might be doing next. I would start with saying that as a company, we don't have an official policy on this yet, and probably won't. We evaluate each situation on a customer by customer basis, so what follows here is more my personal feelings on what people should do at this current point in time. &lt;br /&gt;
&lt;br /&gt;
The one thing I have noticed from the people I have already spoken with is that there seem to be two major camps, an over simplification to be sure, but I break this down into the free software camp (those motivated by a desire to remain on open source, and/or support, free software as a primary driver of technology decisions), and those more interested in the technology than the ideals behind it. Depending on where you fall into that spectrum, you have different options available to you, and will likely reach very different conclusions. &lt;br /&gt;
&lt;br /&gt;
&lt;h4&gt;Too Soon?&lt;/h4&gt;&lt;br /&gt;
The first thing I have said to everyone is that it is honestly too soon to make any moves. Oracle is notorious for being poor communicators, and at this point I don't think we've seen enough official communication to really know what's going to happen. This doesn't mean you can't start planning though! We've been looking at some of the available options since before the Oracle/Sun merger was closed, so it doesn't hurt to start evaluating the options out there. However there's no need to rush in to things; it is possible that the announcement of OpenSolaris's death might be premature. I personally don't believe Solaris can't survive based on the model we've just seen laid out; there are too many people learning the gnu tool chain who won't be willing to invest big money into a tool that is hard for them to use. They need a low cost / free option for people to familiarize themselves on (and all the better if it installs gnu tools by default). There's an outside chance Oracle might come to this conclusion, which would give new life to OpenSolaris. &lt;br /&gt;
&lt;br /&gt;
A more likely alternative to that theory is that &lt;a href=&quot;http://www.xzilla.net/exit.php?url_id=465&amp;amp;entry_id=492&quot; title=&quot;http://www.illumos.org/news/1&quot;&gt;some other group&lt;/a&gt; might pick up OpenSolaris maintenance and start pushing it forward. Certainly not an easy task, but there are already several different distribution of OpenSolaris available, so the userland level management has the resources, we mostly would need to figure out how to handle the more core technologies that have been maintained by Sun. I think this might also be possible, as there are numerous companies already heavily invested in OpenSolaris technology, and there are Solaris internals hackers looking to move out of Oracle, it's not an impossible leap to think we might see something worked out. And if Oracle continues to make technology available via the CDDL (which most of the current signs seem to indicate), this could work out. I would say that this might not resemble the OpenSolaris as it is now, but could definitely be an option for current users who'd like to remain on the OpenSolaris platform.&lt;br /&gt;
&lt;br /&gt;
&lt;h4&gt;Other Options?&lt;/h4&gt;&lt;br /&gt;
Of course, you might not want to put all your eggs in that basket. So what other options do we have? Well, that mostly depends on what you're getting out of OpenSolaris now, and what you want out of your OS going forward. For many people, I suspect that Solaris 11 Express might be a suitable replacement, especially for those running mixed OpenSolaris / Solaris environments. Migrating up to full Solaris 11 will also cover most of your technology needs, so depending on pricing I suspect people may find that a cheaper alternative to migrating to a new platform. Of course, if you want to stick with a free software solution, this won't really be an option. &lt;br /&gt;
&lt;br /&gt;
FreeBSD seems to be the most obvious alternative platform. If you're currently taking advantage of dtrace, zfs, and zones, FreeBSD gives you options to cover all three. It won't be the same; the dtrace and zfs implementations are pretty close aiui, but for zones you'll probably have to use either Jails or OpenVS, neither of which am I a fan of. I think you'd also find a larger overlap in system utilities (tar, find, grep, etc..) between FreeBSD and Solaris, so for people (and scripts) making the transition, this might be an easier move. The big question here is probably hardware support; if you can't get FreeBSD running on your hardware, that's likely to be a show stopper, unless you can work out a new hardware purchase in the transition &lt;img src=&quot;http://www.xzilla.net/templates/default/img/emoticons/smile.png&quot; alt=&quot;:-)&quot; class=&quot;emoticon&quot; /&gt; &lt;br /&gt;
&lt;br /&gt;
So, if you don't want to go closed Solaris, and FreeBSD isn't an option, that probably leaves you on Linux. People sometimes think I don't like Linux; I'm actually very comfortable on it. My first &quot;unix&quot; was Linux, and we run some extremely demanding systems on Linux and it has performed well in those cases. However if you're trying to do deep introspection, systemtap is a poor man's dtrace. And if you are relying on zfs, you'll have a hard time finding a suitable replacement amongst the current Linux options. Personally I am most comfortable on ext3, but I tend to give up on file system snapshots, which is a painful submission if you have to make it. XFS is probably the next most common option, and generally I've no bones about using it if you want to avoid ext3. Of the three &quot;advanced&quot; replacements; ext4, btrfs, and &lt;a href=&quot;http://www.xzilla.net/exit.php?url_id=466&amp;amp;entry_id=492&quot; title=&quot;http://github.com/behlendorf/zfs/wiki&quot;&gt;zfs on linux&lt;/a&gt;; I think ext4 is probably your best bet, but only because zfs is too new for any serious database systems, and if you are moving off OpenSolaris to get away from Oracle, &quot;butter&quot; seems like an odd choice.&lt;br /&gt;
&lt;br /&gt;
&lt;h4&gt;And so...&lt;/h4&gt;&lt;br /&gt;
I think it's wise to keep things in perspective. There are some cases where you want to be a technology leader (we've been running Postgres 9 for months on some systems), but generally speaking when it comes to picking the operating system and filesystem for your database, it's best to tread lightly. Now is a fine time to start evaluating your options; at least figure out what features are critical to your enterprise that you'll need to replace (and don't just think about database, you might be relying on crossbow for something, or who knows what else). We'll certainly be watching the current options available, and I suspect diversifying a little, over the next 6 months, as we wait for the picture to clear up where we can. We're not in a hurry (after all, we do have the source code of what we're running now), and I don't see much reason for others to be either.</content>
		<author>
			<name>Robert Treat</name>
			<email>nospam@example.com</email>
			<uri>http://www.xzilla.net/</uri>
		</author>
		<source>
			<title type="html">zillablog - postgres</title>
			<link rel="self" href="http://www.xzilla.net/feeds/cat/1/postgres.rss"/>
			<id>http://www.xzilla.net/feeds/cat/1/postgres.rss</id>
			<updated>2010-08-18T22:30:32+00:00</updated>
		</source>
	</entry>

	<entry xml:lang="en">
		<title type="html">PostgreSQL Weekly News August 15th 2010</title>
		<link href="http://www.postgresql.org/community/weeklynews/pwn20100815"/>
		<id>http://www.postgresql.org/community/weeklynews/pwn20100815</id>
		<updated>2010-08-15T08:00:00+00:00</updated>
		<content type="html">The Call for Papers for West is open until September 5, 2010.  Details at:
&lt;a href=&quot;http://www.postgresqlconference.org/&quot;&gt;http://www.postgresqlconference.org/&lt;/a&gt;</content>
		<author>
			<name>PostgreSQL Weekly News</name>
			<uri>http://www.postgresql.org/community/weeklynews/</uri>
		</author>
		<source>
			<title type="html">PostgreSQL Weekly News</title>
			<link rel="self" href="http://wwwmaster.postgresql.org/files/weeklynews.xml"/>
			<id>http://wwwmaster.postgresql.org/files/weeklynews.xml</id>
			<updated>2010-08-30T04:15:50+00:00</updated>
		</source>
	</entry>

	<entry xml:lang="en-us">
		<title type="html">Security Meeting in Maryland</title>
		<link href="http://momjian.us/main/blogs/pgblog/2010.html#August_14_2010"/>
		<id>http://momjian.us/main/blogs/pgblog/2010.html#August_14_2010</id>
		<updated>2010-08-15T03:45:01+00:00</updated>
		<content type="html">&lt;p&gt;I have been invited to attend a Postgres security meeting at &lt;a class=&quot;txt2html&quot; href=&quot;http://omniti.com/&quot;&gt;OmniTI&lt;/a&gt; in Maryland on September 8.  The meeting will
include other local Postgres community members, government security experts, and contractors.  
&lt;/p&gt;
&lt;p&gt;The goal of the meeting is for everyone to meet in person and to plan for necessary Postgres security additions and secure installation
guidelines.  While this will be US-government specific, I expect all work products to be publicly released and available to benefit the
larger Postgres global community.
&lt;/p&gt;</content>
		<author>
			<name>Bruce Momjian</name>
			<email>bruce@momjian.us</email>
			<uri>http://momjian.us/main/blogs/pgblog.html</uri>
		</author>
		<source>
			<title type="html">Bruce Momjian: Postgres Blog</title>
			<subtitle type="html">Bruce Momjian: Postgres Blog</subtitle>
			<link rel="self" href="http://momjian.us/main/rss/pgblog.xml"/>
			<id>http://momjian.us/main/rss/pgblog.xml</id>
			<updated>2010-08-17T12:30:10+00:00</updated>
		</source>
	</entry>

	<entry>
		<title type="html">Npgsql 2.0.10 and NpgsqlParameter.Value</title>
		<link href="http://fxjr.blogspot.com/2010/08/npgsql-2010-and-npgsqlparametervalue.html"/>
		<id>tag:blogger.com,1999:blog-15237920.post-114355092422048865</id>
		<updated>2010-08-15T01:13:59+00:00</updated>
		<content type="html">&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Hi all!&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;As you may already know, &lt;/span&gt;&lt;/span&gt;&lt;a href=&quot;http://pgfoundry.org/frs/?group_id=1000140&amp;amp;release_id=1686&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;Npgsql 2.0.10 is out&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;. Besides the usual batch of bug fixes and enhancements, this release has a new feature which needs more attention as it may give you backward compatibility problems.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;b&gt;What happened?&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;With this release, we decided to implement a property in NpgsqlParameter which returns provider specific objects, just like SQLClient does. &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;NpgsqlParameter now features a property called NpgsqlValue. As you may guess, when you use it, you will receive a value whose type is Npgsql specific. &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;b&gt;Why this change?&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;b&gt; &lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;In the past, we had a lot of problems dealing how we would handle values which are specific to Npgsql, like NpgsqlTimestamp from others which are represented in CLR, like DateTime. This situation led to &lt;/span&gt;&lt;a href=&quot;http://pgfoundry.org/tracker/?group_id=1000140&amp;amp;atid=590&amp;amp;func=detail&amp;amp;aid=1010798&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;cast exceptions bugs&lt;/span&gt;&lt;/a&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;. This was the main motivation for this. &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;Also, we think that by implementing this we would be giving our users a much consistent way of getting values in CLR type and in Npgsql-specific type. Another benefit is that now Npgsql can behave better inside DataSet and DataRow objects as they use Value property and expect CLR types being returned.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;b&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;What is the problem and what can I do about it?&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;The problem lies in the fact that now, NpgsqlParameter.Value returns only CLR types. So, if your code was expecting to receive Npgsql specific types you may need to change your code to either use CLR type or change the call to NpgsqlValue property. &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;I think the first option is a good one as it will make your code more portable between other providers. If you are using only Npgsql, second option  is a better choice as it will allow you to use directly Npgsql specific types.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;We would like to hear from you how this modification is working for you. &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;Please, post your questions and suggestions in our &lt;/span&gt;&lt;a href=&quot;http://forums.npgsql.org/&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;user forums&lt;/span&gt;&lt;/a&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;Thanks in advance.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;blogger-post-footer&quot;&gt;&lt;img width=&quot;1&quot; height=&quot;1&quot; src=&quot;https://blogger.googleusercontent.com/tracker/15237920-114355092422048865?l=fxjr.blogspot.com&quot; alt=&quot;&quot; /&gt;&lt;/div&gt;</content>
		<author>
			<name>Francisco Figueiredo Jr.</name>
			<email>noreply@blogger.com</email>
			<uri>http://fxjr.blogspot.com/</uri>
		</author>
		<source>
			<title type="html">Francisco Figueiredo Jr Activities</title>
			<subtitle type="html">On this blog I will post info about myself and the development projects I participate like Npgsql and Mono.
Check out my other blog about Android: http://franciscodroid.blogspot.com</subtitle>
			<link rel="self" href="http://fxjr.blogspot.com/atom.xml"/>
			<id>tag:blogger.com,1999:blog-15237920</id>
			<updated>2010-08-28T17:45:51+00:00</updated>
		</source>
	</entry>

	<entry xml:lang="en">
		<title type="html">Is Google a big enough Billy Goat Gruff?</title>
		<link href="http://people.planetpostgresql.org/andrew/index.php?/archives/100-Is-Google-a-big-enough-Billy-Goat-Gruff.html"/>
		<id>http://people.planetpostgresql.org/andrew/index.php?/archives/100-guid.html</id>
		<updated>2010-08-14T13:40:08+00:00</updated>
		<content type="html">So, now it looks like Oracle's &lt;a href=&quot;http://arstechnica.com/tech-policy/news/2010/08/oracle-sues-google-over-use-of-java-in-android-sdk.ars&quot;&gt;new business model&lt;/a&gt; for actually making money out of their investment in Sun is to become a patent troll. They seem to be going out of their way to make themselves pariahs in the Open Source world, as hated as SCO. Personally, I was always sceptical of their ability or intention to act well. They are simply not an organization that is geared to operating in this milieu. And there are plenty of people who should be at least a bit scared by this development, as Steven J Vaughan-Nichols &lt;a href=&quot;http://blogs.computerworld.com/16736/oracle_vs_google_over_java_in_android_is_only_the_start&quot;&gt;points out&lt;/a&gt;.&lt;br /&gt;
&lt;br /&gt;
I spent a year or two writing Java, and I get a bit impatient with people who like to rag on it. Their information is often out of date and ill-informed, in my experience. But anyone who now bases a major application, especially one which they sell, on Java would need to be very careful about how they proceed. And that involves a world of trouble and disputation. Surely it would be much simpler for any new project simply to say &quot;OK, we'll use other technology, where there is less risk of running foul of patent lawsuits.&quot; That would be my reaction. &lt;br /&gt;
&lt;br /&gt;
Incidentally, this is similar to the reasoning that led me to get involved with Postgres years ago. The company I was working for looked at shipping MySQL as a reference database with their product, and we were not interested in paying for a commercial license. Some people said we could, some said we couldn't. Our take was that we didn't want the hassle. Unless it was beyond dispute, we'd look elsewhere, and the next place we looked, naturally, was Postgres. By the time we decided against using Postgres, because there was then no Windows port, it was too late - I was hooked &lt;img src=&quot;http://people.planetpostgresql.org/andrew/templates/default/img/emoticons/smile.png&quot; alt=&quot;:-)&quot; class=&quot;emoticon&quot; /&gt;</content>
		<author>
			<name>Andrew Dunstan</name>
			<email>nospam@example.com</email>
			<uri>http://people.planetpostgresql.org/andrew/</uri>
		</author>
		<source>
			<title type="html">Andrew's PostgreSQL blog</title>
			<subtitle type="html">My little place on the web...</subtitle>
			<link rel="self" href="http://people.planetpostgresql.org/andrew/index.php?/feeds/index.rss2"/>
			<id>http://people.planetpostgresql.org/andrew/index.php?/feeds/index.rss2</id>
			<updated>2010-08-23T21:45:28+00:00</updated>
		</source>
	</entry>

	<entry xml:lang="en">
		<title type="html">Starting PostgreSQL in windows without install</title>
		<link href="http://www.postgresonline.com/journal/archives/172-Starting-PostgreSQL-in-windows-without-install.html"/>
		<id>http://www.postgresonline.com/journal/archives/172-guid.html</id>
		<updated>2010-08-12T23:25:00+00:00</updated>
		<content type="html">&lt;p&gt;This is a question that comes up quite often by windows users, so thought we would share how we normally do it.  The question is can you run a PostgreSQL server on your windows desktop/server box without having to install anything?
The answer is yes and quite easily.  Why would you need to do this.  There are a couple of cases -- one you are developing a single user app that you want users to be able to run from anywhere without having to install it first.
The other common reason is, you aren't allowed to install anything on a user's pc and you also want to package along a database you already have created.&lt;/p&gt;
&lt;p&gt;For our purposes, many of our developers develop on portable WAMP like things, and for some of our applications, they need to work in both MySQL and PostgreSQL, so we need an easy way during development to swap one out for the other.&lt;/p&gt;

 &lt;br /&gt;&lt;a href=&quot;http://www.postgresonline.com/journal/archives/172-Starting-PostgreSQL-in-windows-without-install.html#extended&quot;&gt;Continue reading &quot;Starting PostgreSQL in windows without install&quot;&lt;/a&gt;</content>
		<author>
			<name>Leo Hsu and Regina Obe</name>
			<email>nospam@example.com</email>
			<uri>http://www.postgresonline.com/journal/</uri>
		</author>
		<source>
			<title type="html">Postgres OnLine Journal</title>
			<subtitle type="html">an In depth look at the PostgreSQL open source database</subtitle>
			<link rel="self" href="http://www.postgresonline.com/journal/index.php?/feeds/index.rss2"/>
			<id>http://www.postgresonline.com/journal/index.php?/feeds/index.rss2</id>
			<updated>2010-08-29T17:15:10+00:00</updated>
		</source>
	</entry>

	<entry>
		<title type="html">Creativity with fuzzy string search</title>
		<link href="http://blog.endpoint.com/2010/08/creativity-with-fuzzy-string-search.html"/>
		<id>tag:blogger.com,1999:blog-7997313029981170997.post-5108861791092937600</id>
		<updated>2010-08-12T14:36:04+00:00</updated>
		<content type="html">&lt;a href=&quot;http://4.bp.blogspot.com/_Q7kwFwwUJ0o/TGHQgYS7zLI/AAAAAAAAAVI/PW-Vjfue3BI/s1600/fuzzy.png&quot;&gt;&lt;img src=&quot;http://4.bp.blogspot.com/_Q7kwFwwUJ0o/TGHQgYS7zLI/AAAAAAAAAVI/PW-Vjfue3BI/s320/fuzzy.png&quot; border=&quot;0&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5503909474319715506&quot; /&gt;&lt;/a&gt;
&lt;p&gt;PostgreSQL provides a useful set of contrib modules for &quot;fuzzy&quot; string searching; that is, searching for something that sounds like or looks like the original search key, but that might not exactly match. One place this type of searching shows up frequently is when looking for peoples' names. For instance, a receptionist at the dentist's office doesn't want to have to ask for the exact spelling of your name every time you call asking for an appointment, so the scheduling application allows &quot;fuzzy&quot; searches, and the receptionist doesn't have to get it exactly right to find out who you really are. The PostgreSQL documentation provides an excellent introduction to the topic in terms of the available modules; &lt;a href=&quot;http://www.postgresonline.com/journal/index.php?/archives/158-Where-is-soundex-and-other-warm-and-fuzzy-string-things.html&quot;&gt;This blog post&lt;/a&gt; also demonstrates some of the things they can do.&lt;/p&gt;
&lt;p&gt;The &lt;a href=&quot;http://www.trisano.org&quot;&gt;TriSano&lt;/a&gt; application was originally written to use soundex search alone to find patient names, but that proved insufficient, particularly because common-sounding last names with unusual spellings would be ranked very poorly in the search results. Our solution, which has worked quite well in practice, involved creative use of PostgreSQL's full-text search combined with the &lt;a href=&quot;http://www.postgresql.org/docs/current/static/pgtrgm.html&quot;&gt;pg_trgm contrib module&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;A trigram is a set of three characters. In the case of pg_trgm, it's three adjacent characters taken from a given input text. The pg_trgm module provides easy ways to extract all possible trigrams from an input, and compare them with similar sets taken from other inputs. Two strings that generate similar trigram lists are, in theory, similar strings. There's no particular reason you couldn't use two, four, or some other number of characters instead of &lt;b&gt;tri&lt;/b&gt;grams, but you'd trade sensitivity and variability. And as the name implies, pg_trgm only supports trigrams.&lt;/p&gt;
&lt;p&gt;Straight trigram search didn't buy us much on top of soundex, so we got a bit more creative. A trigram is just a set of three characters, which looks pretty much just like a word, so we thought we'd try using PostgreSQL's full text search on trigram data. Typically full text search has a list of &quot;stop words&quot;: un-indexed words judged too common and too short to contribute meaningfully to an index. Our words would all be three characters long, so we had to create a new text search configuration using a dictionary with an empty stop word list. With that text search configuration, we could index trigrams effectively.&lt;/p&gt;
&lt;p&gt;This search helped, but wasn't quite good enough. We finally borrowed a simplified version of a data mining technique called &lt;a href=&quot;http://en.wikipedia.org/wiki/Boosting&quot;&gt;&quot;boosting&quot;&lt;/a&gt;, which involves using multiple &quot;weak&quot; classifiers or searchers to create one relatively good result set. We combined straightforward trigram, soundex, and metaphone searches with a normal full text search of the unmodified name data and a full text search over the trigrams generated from the names. The data sizes in question aren't particularly large, so this amount of searching hasn't proven unsustainably taxing on processor power, and it provides excellent results. The code is &lt;a href=&quot;http://blog.endpoint.com/feeds/posts/default/-/postgres/ http://github.com/csinitiative/trisano/blob/master/webapp/db/name_search.sql&quot;&gt;on github&lt;/a&gt;; feel free to try it out.&lt;/p&gt;
&lt;p&gt;Update: One of the comments suggested a demonstration of the results, which of course makes perfect sense. So I resurrected some of the scripts I used when developing the technique. In addition to the scripts used to install the fuzzystrmatch and pg_trgm modules and the name_search.sql script linked above, I had a script that populated the &lt;i&gt;people&lt;/i&gt; table with a bunch of fake names. Then, it's easy to test the search mechanism like this:&lt;/p&gt;
&lt;pre&gt;
select * from search_for_name('John Doe')
as a(id integer, last_name text, first_name text, sources text[], rank double precision);

 id  |  last_name  | first_name |                     sources                     |        rank        
-----+-------------+------------+-------------------------------------------------+--------------------
 167 | Krohn       | Javier     | {trigram_fts,name_trgm,trigram_fts,trigram_fts} |  0.281305521726608
 228 | Jordahl     | Javier     | {trigram_fts,name_trgm,trigram_fts}             |  0.237995445728302
  59 | Pesce       | Dona       | {trigram_fts}                                   |  0.174265757203102
 185 | Finchum     | Dona       | {trigram_fts}                                   |  0.174265757203102
 104 | Rumore      | Dona       | {trigram_fts}                                   |  0.174265757203102
 250 | Dumond      | Julio      | {name_trgm,trigram_fts,trigram_fts}             |   0.16849160194397
 200 | Dedmon      | Javier     | {name_trgm,trigram_fts,trigram_fts}             |  0.163729697465897
 230 | Dossey      | Malinda    | {name_trgm,trigram_fts}                         |  0.158055320382118
  50 | Dress       | Darren     | {name_trgm,trigram_fts}                         |  0.153293430805206
 136 | Doshier     | Neil       | {name_trgm,trigram_fts}                         |  0.148531511425972
 165 | Donatelli   | Lance      | {name_trgm,trigram_fts}                         |  0.132845237851143
 280 | Dollinger   | Clinton    | {name_trgm,trigram_fts}                         |  0.132845237851143
 273 | Dimeo       | Milagros   | {name_trgm,trigram_fts}                         | 0.0866267532110214
  49 | Dawdy       | Christian  | {name_trgm,trigram_fts}                         | 0.0866267532110214
 298 | Elswick     | Jami       | {trigram_fts}                                   | 0.0845221653580666
&lt;/pre&gt;
&lt;p&gt;This isn't all the results it returned, but it gives an idea what the results look like. The rank value ranks results based on the rankings given by each of the underlying search methods, and the sources column shows which of the search methods found this particular entry. Some search methods may show up twice, because that search method found multiple matches between the input text and the result record. These results don't look particularly good, because there isn't really a good match for &quot;John Doe&quot; in the data set. But if I horribly misspell &quot;Jamie Elswick&quot;, the search does a good job:&lt;/p&gt;
&lt;pre&gt;
select * from search_for_name('Jomy Elswik') as a(id integer, last_name text,                                                 
first_name text, sources text[], rank double precision)

 id  |  last_name  | first_name |                     sources                     |        rank        
-----+-------------+------------+-------------------------------------------------+--------------------
 298 | Elswick     | Jami       | {trigram_fts,name_trgm,trigram_fts,trigram_fts} |  0.480943143367767
 312 | Elswick     | Kurt       | {name_trgm,trigram_fts}                         |  0.381967514753342
 228 | Jordahl     | Javier     | {trigram_fts,name_trgm,trigram_fts}             |  0.197063013911247
 403 | Walberg     | Erik       | {trigram_fts}                                   |  0.145491883158684
 309 | Hammaker    | Erik       | {trigram_fts}                                   |  0.145491883158684
&lt;/pre&gt;&lt;div class=&quot;blogger-post-footer&quot;&gt;&lt;img width=&quot;1&quot; height=&quot;1&quot; src=&quot;https://blogger.googleusercontent.com/tracker/7997313029981170997-5108861791092937600?l=blog.endpoint.com&quot; alt=&quot;&quot; /&gt;&lt;/div&gt;</content>
		<author>
			<name>Joshua Tolley</name>
			<email>noreply@blogger.com</email>
			<uri>http://blog.endpoint.com/search/label/postgres</uri>
		</author>
		<source>
			<title type="html">End Point Blog</title>
			<subtitle type="html">Ongoing observations by End Point people.</subtitle>
			<link rel="self" href="http://blog.endpoint.com/feeds/posts/default/-/postgres/"/>
			<id>tag:blogger.com,1999:blog-7997313029981170997</id>
			<updated>2010-09-01T18:30:29+00:00</updated>
		</source>
	</entry>

	<entry>
		<title type="html">PostgreSQL at FroSCon 2010</title>
		<link href="http://psoos.blogspot.com/2010/08/postgresql-at-froscon-2010.html"/>
		<id>tag:blogger.com,1999:blog-6695249769823901911.post-7882620303643568</id>
		<updated>2010-08-10T16:02:20+00:00</updated>
		<content type="html">Like last year, the &lt;a href=&quot;http://www.pgug.de/&quot;&gt;German PostgreSQL User Group&lt;/a&gt; will have a Devroom at &lt;a href=&quot;http://www.froscon.de&quot;&gt;FroSCon&lt;/a&gt; (Sankt Augustin, Germany) this year. There will be talks around PostgreSQL, ASP.NET, the upcoming feature set in 9.0 and a workshop how to setup PostgreSQL 9.0 replication. The talks in detail can be found &lt;a href=&quot;http://programm.froscon.org/2010/day_2010-08-22.de.html&quot;&gt;here&lt;/a&gt; (look for room C117).&lt;br /&gt;&lt;br /&gt;For people interested in technical discussions or brainstorming, there's a booth at the conference, too, where people can meet PostgreSQL community members to discuss their questions. See you there!&lt;div class=&quot;blogger-post-footer&quot;&gt;&lt;img width=&quot;1&quot; height=&quot;1&quot; src=&quot;https://blogger.googleusercontent.com/tracker/6695249769823901911-7882620303643568?l=psoos.blogspot.com&quot; alt=&quot;&quot; /&gt;&lt;/div&gt;</content>
		<author>
			<name>Bernd Helmle</name>
			<email>noreply@blogger.com</email>
			<uri>http://psoos.blogspot.com/search/label/PostgreSQL</uri>
		</author>
		<source>
			<title type="html">Bernd's Blog</title>
			<link rel="self" href="http://psoos.blogspot.com/feeds/posts/default/-/PostgreSQL"/>
			<id>tag:blogger.com,1999:blog-6695249769823901911</id>
			<updated>2010-08-27T10:30:43+00:00</updated>
		</source>
	</entry>

	<entry xml:lang="en">
		<title type="html">BuildFarm Client release 4.1 Announcement</title>
		<link href="http://people.planetpostgresql.org/andrew/index.php?/archives/99-BuildFarm-Client-release-4.1-Announcement.html"/>
		<id>http://people.planetpostgresql.org/andrew/index.php?/archives/99-guid.html</id>
		<updated>2010-08-09T22:39:57+00:00</updated>
		<content type="html">There is a new release of the buildfarm client. There are no new features, but some cleanup and bug fixes.&lt;br /&gt;
&lt;br /&gt;
The code can be downloaded from &lt;a href=&quot;http://pgfoundry.org/frs/download.php/2776/build-farm-4_1.tgz&quot;&gt;pgFoundry&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
Here are the release notes / change logs:&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;Use git clean to remove build products left by vpath builds, following a suggestion from Robert Haas.&lt;/li&gt;&lt;li&gt;provide for &quot;default&quot; entry in force_every setting&lt;/li&gt;&lt;li&gt;Accomodate oddities in at least some versions of File::Copy&lt;/li&gt;&lt;li&gt;If the web transaction fails, put back the old timestamps so the next run works on the same basis&lt;/li&gt;&lt;li&gt;provide enough log to avoid server failure if we get an SCM error (bug found following report from Greg Sabino Mullane)&lt;/li&gt;&lt;li&gt;work with older versions of git (bug found following report from Greg Sabino Mullane)&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;</content>
		<author>
			<name>Andrew Dunstan</name>
			<email>nospam@example.com</email>
			<uri>http://people.planetpostgresql.org/andrew/</uri>
		</author>
		<source>
			<title type="html">Andrew's PostgreSQL blog</title>
			<subtitle type="html">My little place on the web...</subtitle>
			<link rel="self" href="http://people.planetpostgresql.org/andrew/index.php?/feeds/index.rss2"/>
			<id>http://people.planetpostgresql.org/andrew/index.php?/feeds/index.rss2</id>
			<updated>2010-08-23T21:45:28+00:00</updated>
		</source>
	</entry>

	<entry xml:lang="en">
		<title type="html">Financial Support for United States PostgreSQL User Groups</title>
		<link href="http://www.postgresql.us/node/116"/>
		<id>http://www.postgresql.us/116 at http://www.postgresql.us</id>
		<updated>2010-08-09T18:08:30+00:00</updated>
		<content type="html">&lt;p&gt;JD Wrote:&lt;/p&gt;
&lt;p&gt;As the United States PostgreSQL Association continues to grow we are extending the services we provide to our members and the PostgreSQL.Org community in the United States. I am pleased to announce that we have budgeted for 4000.00 USD to be provided to United States based PostgreSQL User Groups from September 2010 through December 2010.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://www.postgresql.us/node/116&quot;&gt;read more&lt;/a&gt;&lt;/p&gt;</content>
		<author>
			<name>US PostgreSQL Association</name>
			<uri>http://www.postgresql.us</uri>
		</author>
		<source>
			<title type="html">United States PostgreSQL Association</title>
			<link rel="self" href="http://www.postgresql.us/rss.xml"/>
			<id>http://www.postgresql.us/rss.xml</id>
			<updated>2010-09-02T14:30:21+00:00</updated>
		</source>
	</entry>

	<entry xml:lang="en-us">
		<title type="html">Why Is standard_conforming_strings Enabled in Postgres 9.1?</title>
		<link href="http://momjian.us/main/blogs/pgblog/2010.html#August_9_2010"/>
		<id>http://momjian.us/main/blogs/pgblog/2010.html#August_9_2010</id>
		<updated>2010-08-09T16:00:00+00:00</updated>
		<content type="html">&lt;p&gt;'depesz' already wrote a clear &lt;a class=&quot;major&quot; href=&quot;http://www.depesz.com/index.php/2010/07/21/waiting-for-9-1-standard_conforming_strings-on/&quot;&gt;blog
entry&lt;/a&gt; explaining the effect of enabling standard_conforming_strings in Postgres 9.1.  My blog entry explains &lt;em&gt;why&lt;/em&gt; it will be changed in
Postgres 9.1.
&lt;/p&gt;
&lt;p&gt;To understand standard_conforming_strings, you have to know some Postgres history.  Postgres is written in the
&lt;a class=&quot;txt2html&quot; href=&quot;http://en.wikipedia.org/wiki/C_%28programming_language%29&quot;&gt;C&lt;/a&gt; language, and some C syntax was added to Postgres for convenience.  For
example, Postgres supports the C syntax for not-equal, != , as well as the SQL-standard non-equal syntax, &amp;lt;&amp;gt;.  This is a good addition
of C syntax because it does not affect SQL-standard-compliant behavior.
&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://momjian.us/main/blogs/pgblog/2010.html#August_9_2010&quot;&gt;Continue Reading &amp;raquo;&lt;/a&gt;&lt;/p&gt;</content>
		<author>
			<name>Bruce Momjian</name>
			<email>bruce@momjian.us</email>
			<uri>http://momjian.us/main/blogs/pgblog.html</uri>
		</author>
		<source>
			<title type="html">Bruce Momjian: Postgres Blog</title>
			<subtitle type="html">Bruce Momjian: Postgres Blog</subtitle>
			<link rel="self" href="http://momjian.us/main/rss/pgblog.xml"/>
			<id>http://momjian.us/main/rss/pgblog.xml</id>
			<updated>2010-08-17T12:30:10+00:00</updated>
		</source>
	</entry>

	<entry>
		<title type="html">Managing Key/Value Pairs in PostgreSQL</title>
		<link href="http://feedproxy.google.com/~r/justatheory/pgsum/~3/S_O6ZcCetmE/key-value-pairs.html"/>
		<id>tag:justatheory.com,2010:/computers/databases/postgresql/key-value-pairs</id>
		<updated>2010-08-09T13:00:00+00:00</updated>
		<content type="html" xml:lang="en-us">&lt;div&gt;&lt;p&gt;Let's say that you've been following the &lt;a href=&quot;http://it.toolbox.com/blogs/database-soup/runningwithscissorsdb-39879&quot; title=&quot;RunningWithScissorsDB&quot;&gt;latest research&lt;/a&gt; in key/value data storage and are interested in managing such data in a PostgreSQL database. You want to have functions to store and retrieve pairs, but there is no natural way to represent pairs in SQL. Many languages have hashes or or data dictionaries to fulfill this role, and you can pass them to functional interfaces. SQL's got nothin’. In PostgreSQL, have two options: use nested arrays (simple, fast) or use a custom composite data type (sugary, legible).&lt;/p&gt;&lt;p&gt;&lt;a href=&quot;http://justatheory.com/computers/databases/postgresql/key-value-pairs.html&quot;&gt;Read More »&lt;/a&gt;&lt;/p&gt;&lt;img src=&quot;http://feeds.feedburner.com/~r/justatheory/pgsum/~4/S_O6ZcCetmE&quot; height=&quot;1&quot; width=&quot;1&quot; /&gt;&lt;/div&gt;</content>
		<author>
			<name>David E. Wheeler</name>
			<uri>http://justatheory.com</uri>
		</author>
		<source>
			<title type="html">Just a Theory</title>
			<subtitle type="html">Theory waxes practical. By David Wheeler.</subtitle>
			<link rel="self" href="http://feeds2.feedburner.com/justatheory/pgsum"/>
			<id>tag:justatheory.com,2010:/computers/databases</id>
			<updated>2010-08-30T15:30:50+00:00</updated>
		</source>
	</entry>

	<entry xml:lang="en-us">
		<title type="html">Editing constants in constraints</title>
		<link href="http://blog.tapoueh.org/blog.dim.html#%20Editing%20constants%20in%20constraints"/>
		<id>http://blog.tapoueh.org/blog.dim.html#%20Editing%20constants%20in%20constraints</id>
		<updated>2010-08-09T11:45:00+00:00</updated>
		<content type="html">&lt;p&gt;&lt;a name=&quot;20100809-14:30&quot; id=&quot;20100809-14:30&quot;&gt;&lt;/a&gt;
We're using constants in some constraints here, for example in cases where
several servers are replicating to the same &lt;em&gt;federating&lt;/em&gt; one: each origin
server has his own schema, and all is replicated nicely on the central host,
thanks to &lt;a href=&quot;http://wiki.postgresql.org/wiki/Londiste_Tutorial#Federated_database&quot;&gt;Londiste&lt;/a&gt;, as you might have guessed already.&lt;/p&gt;

&lt;p&gt;For bare-metal recovery scripts, I'm working on how to change those
constants in the constraints, so that &lt;code&gt;pg_dump -s&lt;/code&gt; plus some schema tweaking
would kick-start a server. Here's a &lt;code&gt;PLpgSQL&lt;/code&gt; snippet to do just that:&lt;/p&gt;

&lt;pre class=&quot;src&quot;&gt;
  &lt;span&gt;FOR&lt;/span&gt; rec &lt;span&gt;IN&lt;/span&gt; &lt;span&gt;EXECUTE&lt;/span&gt;
$s$
&lt;span&gt;SELECT&lt;/span&gt; schemaname, tablename, conname, attnames, def
  &lt;span&gt;FROM&lt;/span&gt; (
   &lt;span&gt;SELECT&lt;/span&gt; n.nspname, c.relname, r.conname,
          (&lt;span&gt;select&lt;/span&gt; array_accum(attname)
             &lt;span&gt;from&lt;/span&gt; pg_attribute
            &lt;span&gt;where&lt;/span&gt; attrelid = c.oid &lt;span&gt;and&lt;/span&gt; r.conkey @&amp;gt; &lt;span&gt;array&lt;/span&gt;[attnum]) &lt;span&gt;as&lt;/span&gt; attnames,
          pg_catalog.pg_get_constraintdef(r.oid, &lt;span&gt;true&lt;/span&gt;)
   &lt;span&gt;FROM&lt;/span&gt; pg_catalog.pg_constraint r
        &lt;span&gt;JOIN&lt;/span&gt; pg_class c &lt;span&gt;on&lt;/span&gt; c.oid = r.conrelid
        &lt;span&gt;JOIN&lt;/span&gt; pg_namespace n &lt;span&gt;ON&lt;/span&gt; n.oid = c.relnamespace
   &lt;span&gt;WHERE&lt;/span&gt; r.contype = &lt;span&gt;'c'&lt;/span&gt;
&lt;span&gt;ORDER&lt;/span&gt; &lt;span&gt;BY&lt;/span&gt; 1, 2, 3
       ) &lt;span&gt;as&lt;/span&gt; cons(schemaname, tablename, conname, attnames, def)
&lt;span&gt;WHERE&lt;/span&gt; attnames @&amp;gt; &lt;span&gt;array&lt;/span&gt;[&lt;span&gt;'server'&lt;/span&gt;]::&lt;span&gt;name&lt;/span&gt;[]
$s$
  LOOP
    rec.def := replace(rec.def, &lt;span&gt;'server = '&lt;/span&gt; || old_id,
                                &lt;span&gt;'server = '&lt;/span&gt; || new_id);

    &lt;span&gt;sql&lt;/span&gt; := &lt;span&gt;'ALTER TABLE '&lt;/span&gt; || rec.schemaname || &lt;span&gt;'.'&lt;/span&gt; || rec.tablename
        || &lt;span&gt;' DROP CONSTRAINT '&lt;/span&gt; || rec.conname;
    RAISE NOTICE &lt;span&gt;'%'&lt;/span&gt;, &lt;span&gt;sql&lt;/span&gt;;
    &lt;span&gt;RETURN&lt;/span&gt; &lt;span&gt;NEXT&lt;/span&gt;;
    &lt;span&gt;EXECUTE&lt;/span&gt; &lt;span&gt;sql&lt;/span&gt;;

    &lt;span&gt;sql&lt;/span&gt; := &lt;span&gt;'ALTER TABLE '&lt;/span&gt; || rec.schemaname || &lt;span&gt;'.'&lt;/span&gt; || rec.tablename
        || &lt;span&gt;' ADD '&lt;/span&gt; || rec.def;
    RAISE NOTICE &lt;span&gt;'%'&lt;/span&gt;, &lt;span&gt;sql&lt;/span&gt;;
    &lt;span&gt;RETURN&lt;/span&gt; &lt;span&gt;NEXT&lt;/span&gt;;
    &lt;span&gt;EXECUTE&lt;/span&gt; &lt;span&gt;sql&lt;/span&gt;;

  &lt;span&gt;END&lt;/span&gt; LOOP;
&lt;/pre&gt;

&lt;p&gt;This relies on the fact that our constraints are on the column &lt;code&gt;server&lt;/code&gt;. Why
would this be any better than a &lt;code&gt;sed&lt;/code&gt; one-liner, would you ask me? I'm fed up
with having pseudo-parsing scripts and taking the risk that the simple
command will change data I didn't want to edit. I want context aware tools,
pretty please, to &lt;em&gt;feel&lt;/em&gt; safe.&lt;/p&gt;

&lt;p&gt;Otherwise I'd might have gone with &lt;code&gt;pg_dump -s| sed -e 's:\(server =\)
17:\1 18:'&lt;/code&gt; but this one-liner already contains too much useless magic
for my taste (the space before &lt;code&gt;17&lt;/code&gt; ain't in the group match to allow for
having &lt;code&gt;\1 18&lt;/code&gt; in the right hand side. And this isn't yet parametrized, and
there I'll need to talk to the database, as that's were I store the servers
name and their id (a &lt;code&gt;bigserial&lt;/code&gt; — yes, the constraints are all generated from
scripts). I don't want to write an &lt;em&gt;SQL parser&lt;/em&gt; and I don't want to play
loose, so the &lt;code&gt;PLpgSQL&lt;/code&gt; approach is what I'm thinking as the best tool
here. Opinionated answers get to my mailbox!&lt;/p&gt;</content>
		<author>
			<name>Dimitri Fontaine</name>
			<uri>http://blog.tapoueh.org/blog.dim.html</uri>
		</author>
		<source>
			<title type="html">tail -f /dev/dim</title>
			<subtitle type="html">dim's PostgreSQL blog</subtitle>
			<link rel="self" href="http://blog.tapoueh.org/blog.dim.xml"/>
			<id>http://blog.tapoueh.org/blog.dim.xml</id>
			<updated>2010-08-31T12:45:46+00:00</updated>
		</source>
	</entry>

	<entry xml:lang="en">
		<title type="html">Waiting for 9.1 – Recognize functional dependency on primary keys.</title>
		<link href="http://www.depesz.com/index.php/2010/08/08/waiting-for-9-1-recognize-functional-dependency-on-primary-keys/"/>
		<id>http://www.depesz.com/?p=1800</id>
		<updated>2010-08-08T20:43:33+00:00</updated>
		<content type="html">Yesterday (August, 7th), Tom Lane committed: Log Message: ----------- Recognize functional dependency on primary keys. This allows a table's other columns to be referenced without listing them in GROUP BY, so long as the primary key column(s) are listed in GROUP BY. &amp;#160; Eventually we should also allow functional dependency on a UNIQUE constraint when [...]</content>
		<author>
			<name>Hubert Lubaczewski</name>
			<uri>http://www.depesz.com</uri>
		</author>
		<source>
			<title type="html">select * from depesz; » postgresql</title>
			<link rel="self" href="http://www.depesz.com/index.php/tag/postgresql/feed/"/>
			<id>http://www.depesz.com/index.php/tag/postgresql/feed/</id>
			<updated>2010-08-30T12:16:45+00:00</updated>
		</source>
	</entry>

	<entry xml:lang="en">
		<title type="html">Planning for when the git repo goes live</title>
		<link href="http://people.planetpostgresql.org/andrew/index.php?/archives/98-Planning-for-when-the-git-repo-goes-live.html"/>
		<id>http://people.planetpostgresql.org/andrew/index.php?/archives/98-guid.html</id>
		<updated>2010-08-08T18:39:35+00:00</updated>
		<content type="html">The cutover is due to happen soon,&lt;br /&gt;
&lt;br /&gt;
Currently I have the following setup:&lt;br /&gt;
&lt;ul&gt;&lt;br /&gt;
&lt;li&gt;On Fedora 6: a CVS mirror and a buildfarm animal, dungbeetle that uses it. This machine will retire some time in the next few months, and will probably be replaced by a machine running CentOS 6 when it is released.&lt;/li&gt;&lt;br /&gt;
&lt;li&gt;On Fedora 11, a mirror of my git repo that reflects the CVS state on github, and a buildfarm member quoll, that uses it. This is also where the github repo gets built.&lt;/li&gt;&lt;br /&gt;
&lt;li&gt;On Windows NT, another mirror of my github repo, and three buildfarm members, dawn_bat, red_bat and brown_bat, that use it&lt;/li&gt;&lt;br /&gt;
&lt;/ul&gt;&lt;br /&gt;
When CVS goes quiet, I will need to do the following:&lt;br /&gt;
&lt;ul&gt;&lt;br /&gt;
&lt;li&gt;On all these machines, create mirrors of the new community repo, and cron jobs to keep them updated. The good news is that git is a whole lot more efficient about this than CVS is, so runs of &quot;git fetch&quot; won't place much stress on either then client or the server.&lt;/li&gt; &lt;br /&gt;
&lt;li&gt;Blow away all the per-branch repositories for all the buildfarm members, and change the config settings for 'scm', 'scmrepo' and 'scm_url'. The repo will point to the machine-local mirror. On dungbeetle, that means also removing the legacy 'cvsmethod' and 'cvsrepo' config settings.&lt;/li&gt; &lt;br /&gt;
&lt;/ul&gt;&lt;br /&gt;
I'll probably be doing this while I'm a long way from home, but with luck all will run smoothly.&lt;br /&gt;
&lt;br /&gt;
When everything is settled down I will turn off my CVS mirrors. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;</content>
		<author>
			<name>Andrew Dunstan</name>
			<email>nospam@example.com</email>
			<uri>http://people.planetpostgresql.org/andrew/</uri>
		</author>
		<source>
			<title type="html">Andrew's PostgreSQL blog</title>
			<subtitle type="html">My little place on the web...</subtitle>
			<link rel="self" href="http://people.planetpostgresql.org/andrew/index.php?/feeds/index.rss2"/>
			<id>http://people.planetpostgresql.org/andrew/index.php?/feeds/index.rss2</id>
			<updated>2010-08-23T21:45:28+00:00</updated>
		</source>
	</entry>

	<entry xml:lang="en-us">
		<title type="html">Speaking in New York City</title>
		<link href="http://momjian.us/main/blogs/pgblog/2010.html#August_8_2010"/>
		<id>http://momjian.us/main/blogs/pgblog/2010.html#August_8_2010</id>
		<updated>2010-08-08T16:00:00+00:00</updated>
		<content type="html">&lt;p&gt;I am speaking at the &lt;a class=&quot;major&quot; href=&quot;http://www.meetup.com/postgresql-3/calendar/14310923/&quot;&gt;New York PostgreSQL Meetup Group&lt;/a&gt; this Tuesday about the
new features in Postgres 9.0.  (It will be similar to a &lt;a class=&quot;major&quot; href=&quot;http://www.enterprisedb.com/learning/walkthrough_postgres_9_0.do&quot;&gt;webcast&lt;/a&gt;
I did a few months ago.)
&lt;/p&gt;
&lt;p&gt;I have a few interesting conferences coming up:  &lt;a class=&quot;major&quot; href=&quot;http://momjian.us/main/events/conferences/2010.html&quot;&gt;SURGE&lt;/a&gt; (Baltimore),
&lt;a class=&quot;major&quot; href=&quot;http://momjian.us/main/events/conferences/2010.html&quot;&gt;OpenSQL Camp&lt;/a&gt; (Massachusetts),
&lt;a class=&quot;major&quot; href=&quot;https://www.postgresqlconference.org/&quot;&gt;PgWest 2010&lt;/a&gt; (San Francisco), and perhaps &lt;a class=&quot;major&quot; href=&quot;http://2010.pgday.eu/&quot;&gt;PGDay Europe 2010&lt;/a&gt;
(Germany).
&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://momjian.us/main/blogs/pgblog/2010.html#August_8_2010&quot;&gt;Continue Reading &amp;raquo;&lt;/a&gt;&lt;/p&gt;</content>
		<author>
			<name>Bruce Momjian</name>
			<email>bruce@momjian.us</email>
			<uri>http://momjian.us/main/blogs/pgblog.html</uri>
		</author>
		<source>
			<title type="html">Bruce Momjian: Postgres Blog</title>
			<subtitle type="html">Bruce Momjian: Postgres Blog</subtitle>
			<link rel="self" href="http://momjian.us/main/rss/pgblog.xml"/>
			<id>http://momjian.us/main/rss/pgblog.xml</id>
			<updated>2010-08-17T12:30:10+00:00</updated>
		</source>
	</entry>

	<entry xml:lang="en">
		<title type="html">Waiting for 9.1 – Reduced lock levels for ALTER TABLE</title>
		<link href="http://www.depesz.com/index.php/2010/08/08/waiting-for-9-1-reduced-lock-levels-for-alter-table/"/>
		<id>http://www.depesz.com/?p=1795</id>
		<updated>2010-08-08T13:20:33+00:00</updated>
		<content type="html">On 28th of July, Simon Riggs committed patch which: Log Message: ----------- Reduce lock levels of CREATE TRIGGER and some ALTER TABLE, CREATE RULE actions. Avoid hard-coding lockmode used for many altering DDL commands, allowing easier future changes of lock levels. Implementation of initial analysis on DDL sub-commands, so that many lock levels are now [...]</content>
		<author>
			<name>Hubert Lubaczewski</name>
			<uri>http://www.depesz.com</uri>
		</author>
		<source>
			<title type="html">select * from depesz; » postgresql</title>
			<link rel="self" href="http://www.depesz.com/index.php/tag/postgresql/feed/"/>
			<id>http://www.depesz.com/index.php/tag/postgresql/feed/</id>
			<updated>2010-08-30T12:16:45+00:00</updated>
		</source>
	</entry>

	<entry xml:lang="en">
		<title type="html">PostgreSQL Weekly News August 8th 2010</title>
		<link href="http://www.postgresql.org/community/weeklynews/pwn20100808"/>
		<id>http://www.postgresql.org/community/weeklynews/pwn20100808</id>
		<updated>2010-08-08T08:00:00+00:00</updated>
		<content type="html">Bruce Momjian's will walk through PostgreSQL 9.0 at the next NYC
PostgreSQL Meetup, August 10th at 6:00 pm.  RSVP below:
&lt;a href=&quot;http://www.meetup.com/postgresql-3/calendar/14310923/&quot;&gt;http://www.meetup.com/postgresql-3/calendar/14310923/&lt;/a&gt;</content>
		<author>
			<name>PostgreSQL Weekly News</name>
			<uri>http://www.postgresql.org/community/weeklynews/</uri>
		</author>
		<source>
			<title type="html">PostgreSQL Weekly News</title>
			<link rel="self" href="http://wwwmaster.postgresql.org/files/weeklynews.xml"/>
			<id>http://wwwmaster.postgresql.org/files/weeklynews.xml</id>
			<updated>2010-08-30T04:15:50+00:00</updated>
		</source>
	</entry>

	<entry>
		<title type="html">Tail_n_mail and the log_line_prefix curse</title>
		<link href="http://blog.endpoint.com/2010/08/tailnmail-and-loglineprefix-curse.html"/>
		<id>tag:blogger.com,1999:blog-7997313029981170997.post-2026186471537780297</id>
		<updated>2010-08-06T12:15:23+00:00</updated>
		<content type="html">span{font-family:sans-serif;}span.c{color:red;}span.t{font-family:sans-serif;color:green;}span.o{font-family:sans-serif;color:blue;}&lt;a href=&quot;http://1.bp.blogspot.com/_BSsdd9WIV2k/TFwhHMyqu0I/AAAAAAAAACY/y192Y8bHTis/s1600/elephants_sunset_tnm.jpg&quot;&gt;&lt;img src=&quot;http://1.bp.blogspot.com/_BSsdd9WIV2k/TFwhHMyqu0I/AAAAAAAAACY/y192Y8bHTis/s320/elephants_sunset_tnm.jpg&quot; border=&quot;0&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5502309252316445506&quot; /&gt;&lt;/a&gt;
&lt;p&gt;One of the problems I had when writing &lt;a href=&quot;http://bucardo.org/wiki/Tail_n_mail&quot;&gt;tail_n_mail&lt;/a&gt; (a program that parses log files and mails interesting lines to you) was getting the program to understand the format of the Postgres log files. There are quite a few options inside of postgresql.conf that control where the logging goes, and what it looks like. The basic three options are to send it to a rotating logfile with a custom prefix at the start of each line, to use &lt;a href=&quot;http://en.wikipedia.org/wiki/Syslog&quot;&gt;syslog&lt;/a&gt;, or to write it in &lt;a href=&quot;http://www.postgresql.org/docs/current/static/runtime-config-logging.html#RUNTIME-CONFIG-LOGGING-CSVLOG&quot;&gt;CSV format&lt;/a&gt;. I'll save a discussion of all the logging parameters for another time, but the important one for this story is &lt;strong&gt;log_line_prefix&lt;/strong&gt;. This is what gets prepended to each log line when using 'stderr' mode (e.g. regular log files and not syslog or csvlog). By default, log_line_prefix is an empty string. This is a very useless default.&lt;/p&gt;&lt;p&gt;What you can put in the log_line_prefix parameter is a string of sprintf style escapes, which Postgres will expand for you as it writes the log. There are a large number of escapes, but only a few are commonly used or useful. Here's a log_line_prefix I commonly use:&lt;/p&gt;&lt;pre&gt;&lt;span class=&quot;c&quot;&gt;
log_line_prefix = '%t [%p] %u@%d '
&lt;/span&gt;&lt;/pre&gt;&lt;p&gt;This tells Postgres to print out the timestamp, the PID aka process id (inside of square brackets), the current username and database name, and finally a single space to help separate the prefix visually from the rest of the line. The above will generate lines that look like this:&lt;/p&gt;&lt;pre&gt;&lt;span class=&quot;o&quot;&gt;
2010-08-06 09:24:57.714 EDT [7229] joy@joymail LOG: execute dbdpg_p7228_5: SELECT count(id) FROM joymail WHERE folder = $1
2010-08-06 09:24:57.714 EDT [7229] joy@joymail DETAIL:  parameters: $1 = '4'
&lt;/span&gt;&lt;/pre&gt;&lt;p&gt;As you might imagine, the customizability of log_line_prefix makes parsing the log files all but impossible without some prior knowledge. I didn't want to go the pgfouine route and make people change their log_line_prefix to a specific setting. I think it's kind of rude to force your database to change its logging to accommodate your tools :). The original quick solution I came up with was to have a set of predefined regular expressions and the user would pick one that most closely matched their logs. For tail_n_mail to work properly, it needs to pick up at least the PID so it can tell when one statement ends a new one begins. For example, if you chose &quot;regex #1&quot;, the log parsing regex would look like this:&lt;/p&gt;&lt;pre&gt;&lt;span class=&quot;c&quot;&gt;
(\d\d\d\d\-\d\d\-\d\d \d\d:\d\d:\d\d).+?(\d+)
&lt;/span&gt;&lt;/pre&gt;&lt;p&gt;This works fine on the example above, and gets us the timestamp and the PID from each line. The stock regexes worked for many different log_line_prefixes I came across that our clients were using, but I was never very happy with this solution. Not only was it susceptible to failing completely when a client was using a log_line_prefix not fitting into the current list of regexes, but there was no way to know exactly where the prefix ended and the statement began, which is important for the formatting of the output and the canonicaliztion of similar queries.&lt;/p&gt;&lt;p&gt;Enter the current solution: building a regex on the fly. Since we don't have a connection to the database at all, merely to the the log files, this requires that the user enter in their current log_line_prefix. This is a simple entry into the &lt;strong&gt;tailnmailrc&lt;/strong&gt; file that looks just like the entry in postgresql.conf, e.g.:&lt;/p&gt;&lt;pre&gt;&lt;span class=&quot;c&quot;&gt;
log_line_prefix = '%t [%p] %u@%d '
&lt;/span&gt;&lt;/pre&gt;&lt;p&gt;The tail_n_mail script uses that variable to build a custom regex specifically tailored to that log_line_prefix and thus to the Postgres logs being used. Not only can we grab whatever bits we want (currently we only care about the timestamp (%t and %m) and the PID (%p)), but we can now cleanly break apart each line in the log into the prefix and the actual statement. This means the canonicalization/flattening of the queries is more effective, and allows us to only output the prefix information once. The output of tail_n_mail looks something like this:&lt;/p&gt;&lt;pre&gt;&lt;span class=&quot;o&quot;&gt;
Date: Fri Aug  6 11:01:03 2010 UTC                                                        
Host: whale.example.com
Unique items: 7
Total matches: 85
Matches from [A] /var/log/pg_log/postgresql-2010-08-05.log: 61
Matches from [B] /var/log/pg_log/postgresql-2010-08-06.log: 24

[1] From files A to B (between lines 14,205 of A and 527 of B, occurs 64 times)
First: [A] 2010-08-05 16:52:11 UTC [1602]  postgres@mydb
Last:  [B] 2010-08-06 01:18:14 UTC [20981] postgres@mydb
ERROR: syntax error at or near &quot;)&quot; 
STATEMENT: INSERT INTO mytable (id, foo, bar) VALUES (?,?,?))
-
ERROR: syntax error at or near &quot;)&quot;
STATEMENT: INSERT INTO mytable (id, foo, bar) VALUES (123,'chocolate','donut'));

[2] From file A (line 12,172)                                                                                                
2010-08-05 12:27:48 UTC [2906] bob@otherdb
ERROR: invalid input syntax for type date: &quot;May&quot; 
STATEMENT: UPDATE personnel SET birthdate='May' WHERE id = 1234;

(plus five other entries)
&lt;/span&gt;&lt;/pre&gt;&lt;p&gt;For the entry in the above example, we are able to show the complete prefix of the log lines where the error first occurred and where it most recently occurred. The next two lines show the &quot;flattened&quot; version of the query that tail_n_mail uses to group together similar errors. We then show a non-flattened example of an actual query from that group. In this case, someone added an extra closing paren in their application somewhere, which gives the same error each time, although the exact output changes depending on the values used. In the second example, because there is only one match, we don't bother to show the flattened version at all.&lt;/p&gt;&lt;p&gt;So in theory tail_n_mail should be now be able to handle any Postgres log you care to throw at it (yes, it can read syslog and csvlog format as well). As my &lt;a href=&quot;http://www.endpoint.com/team/ethan_rowe&quot;&gt;coworker&lt;/a&gt; pointed out, parsing log files in this way is something that should probably be abstracted into a common module so other tools like &lt;a href=&quot;http://bucardo.org/wiki/Pgsi&quot;&gt;pgsi&lt;/a&gt; can take advantage of it as well.&lt;/p&gt;&lt;div class=&quot;blogger-post-footer&quot;&gt;&lt;img width=&quot;1&quot; height=&quot;1&quot; src=&quot;https://blogger.googleusercontent.com/tracker/7997313029981170997-2026186471537780297?l=blog.endpoint.com&quot; alt=&quot;&quot; /&gt;&lt;/div&gt;</content>
		<author>
			<name>Greg Sabino Mullane</name>
			<email>noreply@blogger.com</email>
			<uri>http://blog.endpoint.com/search/label/postgres</uri>
		</author>
		<source>
			<title type="html">End Point Blog</title>
			<subtitle type="html">Ongoing observations by End Point people.</subtitle>
			<link rel="self" href="http://blog.endpoint.com/feeds/posts/default/-/postgres/"/>
			<id>tag:blogger.com,1999:blog-7997313029981170997</id>
			<updated>2010-09-01T18:30:29+00:00</updated>
		</source>
	</entry>

	<entry xml:lang="en-us">
		<title type="html">debian packaging PostgreSQL extensions</title>
		<link href="http://blog.tapoueh.org/blog.dim.html#%20debian%20packaging%20PostgreSQL%20extensions"/>
		<id>http://blog.tapoueh.org/blog.dim.html#%20debian%20packaging%20PostgreSQL%20extensions</id>
		<updated>2010-08-06T10:00:00+00:00</updated>
		<content type="html">&lt;p&gt;&lt;a name=&quot;20100806-13:00&quot; id=&quot;20100806-13:00&quot;&gt;&lt;/a&gt;
In trying to help an extension &lt;em&gt;debian packaging&lt;/em&gt; effort, I've once again
proposed to handle it. That's because I now begin to know how to do it, as
you can see in my &lt;a href=&quot;http://qa.debian.org/developer.php?login=dim%40tapoueh.org&quot;&gt;package overview&lt;/a&gt; page at &lt;em&gt;debian QA&lt;/em&gt; facility. There's a
reason why I proposed myself here, it's that yet another tool of mine is now
to be found in &lt;em&gt;debian&lt;/em&gt;, and should greatly help &lt;em&gt;extension packaging&lt;/em&gt;
there. You can already check for the &lt;a href=&quot;http://packages.debian.org/sid/postgresql-server-dev-all&quot;&gt;postgresql-server-dev-all&lt;/a&gt; package page
if you're that impatient!&lt;/p&gt;

&lt;p&gt;Back? Ok, so I used to have two main gripes against debian support for
&lt;a href=&quot;http://www.postgresql.org/&quot;&gt;PostgreSQL&lt;/a&gt;. The first one, which is now feeling alone, is that both project
&lt;a href=&quot;http://wiki.postgresql.org/wiki/PostgreSQL_Release_Support_Policy&quot;&gt;release support policy&lt;/a&gt; aren't compatible enough for debian stable to include
all currently supported stable PostgreSQL major version. That's very bad
that debian stable will only propose one major version, knowing that the
support for several of them is in there.&lt;/p&gt;

&lt;p&gt;The problem is two fold: first, debian stable has to maintain any
distributed package. There's no &lt;em&gt;deprecation policy&lt;/em&gt; allowing for droping the
ball. So the other side of this coin is that debian developers must take on
themselves maintaining included software for as long as stable is not
renamed &lt;code&gt;oldstable&lt;/code&gt;. And it so happens that there's no debian developer that
feels like maintaining &lt;em&gt;end of lined&lt;/em&gt; PostgreSQL releases without help from
&lt;a href=&quot;http://www.postgresql.org/community/contributors/&quot;&gt;PostgreSQL Core Team&lt;/a&gt;. Or, say, without official statement that they would
help.&lt;/p&gt;

&lt;p&gt;Now, why I don't like this situation is because I'm pretty sure there's very
few software development group offering as long and reliable maintenance
policy as PostgreSQL is doing, but debian will still happily distribute
&lt;em&gt;unknown-maintenance-policy&lt;/em&gt; pieces of code in its stable repositories. So the
&lt;em&gt;uncertainty&lt;/em&gt; excuse is rather poor. And highly frustrating.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p class=&quot;quoted&quot;&gt;
&lt;strong&gt;&lt;em&gt;Note:&lt;/em&gt;&lt;/strong&gt; you have to admit that the debian stable management model copes very
well with all the debian included software. You can't release stable with
a new PostgreSQL major version unless each and every package depending on
PostgreSQL will actually work with the newer version, and the debian
scripts will care for upgrading the cluster. Where it's not working good
is when you're using debian for a PostgreSQL server for a proprietary
application, which happens quite frequently too.&lt;/p&gt;

&lt;/blockquote&gt;

&lt;p&gt;The consequence of this fact leads to my second main gripe against debian
support for PostgreSQL: the extensions. It so happens that the PostgreSQL
extensions are developped for supporting several major versions from the
same source code. So typically, all you need to do is recompile the
extension against the new major version, and there you go.&lt;/p&gt;

&lt;p&gt;Now, say debian new stable is coming with &lt;a href=&quot;http://packages.debian.org/squeeze/postgresql-8.4&quot;&gt;8.4&lt;/a&gt; rather than &lt;a href=&quot;http://packages.debian.org/lenny/postgresql-8.3&quot;&gt;8.3&lt;/a&gt; as it used
to. You should be able to just build the extensions (like &lt;a href=&quot;http://packages.debian.org/squeeze/postgresql-8.4-prefix&quot;&gt;prefix&lt;/a&gt;), without
changing the source package, nor droping &lt;code&gt;postgresql-8.3-prefix&lt;/code&gt; from the
distribution on the grounds that &lt;code&gt;8.3&lt;/code&gt; ain't in debian stable anymore.&lt;/p&gt;

&lt;p&gt;I've been ranting a lot about this state of facts, and I finally provided a
patch to the &lt;a href=&quot;http://packages.debian.org/sid/postgresql-common&quot;&gt;postgresql-common&lt;/a&gt; debian packaging, which made it into version
&lt;code&gt;110&lt;/code&gt;: welcome &lt;a href=&quot;http://packages.debian.org/sid/postgresql-server-dev-all&quot;&gt;pg_buildext&lt;/a&gt;. An exemple of how to use it can be found in the
git branch for &lt;a href=&quot;http://github.com/dimitri/prefix&quot;&gt;prefix&lt;/a&gt;, it shows up in &lt;a href=&quot;http://github.com/dimitri/prefix/blob/master/debian/pgversions&quot;&gt;debian/pgversions&lt;/a&gt; and &lt;a href=&quot;http://github.com/dimitri/prefix/blob/master/debian/rules&quot;&gt;debian/rules&lt;/a&gt;
files.&lt;/p&gt;

&lt;p&gt;As you can see, the &lt;code&gt;pg_buildext&lt;/code&gt; tool allows you to list the PostgreSQL major
versions the extension you're packaging supports, and only those that are
both in your list and in the current debian supported major version list
will get built. &lt;code&gt;pg_buildext&lt;/code&gt; will do a &lt;code&gt;VPATH&lt;/code&gt; build of your extension, so it's
capable of building the same extension for multiple major versions of
PostgreSQL. Here's how it looks:&lt;/p&gt;

&lt;pre class=&quot;src&quot;&gt;
        # build all supported version
        pg_buildext build $(SRCDIR) $(TARGET) &lt;span&gt;&quot;$(CFLAGS)&quot;&lt;/span&gt;

        # then install each of them
        for v in `pg_buildext supported-versions $(SRCDIR)`; do \
                dh_install -ppostgresql-$$v-prefix ;\
        done
&lt;/pre&gt;

&lt;p&gt;And the files are to be found in those places:&lt;/p&gt;

&lt;pre class=&quot;src&quot;&gt;
dim ~/dev/prefix cat debian/postgresql-8.3-prefix.install
debian/prefix-8.3/prefix.so usr/lib/postgresql/8.3/lib
debian/prefix-8.3/prefix.sql usr/share/postgresql/8.3/contrib

dim ~/dev/prefix cat debian/postgresql-8.4-prefix.install
debian/prefix-8.4/prefix.so usr/lib/postgresql/8.4/lib
debian/prefix-8.4/prefix.sql usr/share/postgresql/8.4/contrib
&lt;/pre&gt;

&lt;p&gt;So you still need to maintain &lt;a href=&quot;http://github.com/dimitri/prefix/blob/master/debian/pgversions&quot;&gt;debian/pgversions&lt;/a&gt; and the
&lt;code&gt;postgresql-X.Y-extension.*&lt;/code&gt; files, but then a change in debian support for
PostgreSQL major versions will be handled automatically (there's a facility
to trigger automatic rebuild when necessary).&lt;/p&gt;

&lt;p&gt;All this ranting to explain that pretty soon, the extenion's packages that I
maintain will no longer have to be patched when dropping a previously
supported major version of PostgreSQL. I'm breathing a little better, so
thanks a lot &lt;a href=&quot;http://www.piware.de/category/debian/&quot;&gt;Martin&lt;/a&gt;!&lt;/p&gt;</content>
		<author>
			<name>Dimitri Fontaine</name>
			<uri>http://blog.tapoueh.org/blog.dim.html</uri>
		</author>
		<source>
			<title type="html">tail -f /dev/dim</title>
			<subtitle type="html">dim's PostgreSQL blog</subtitle>
			<link rel="self" href="http://blog.tapoueh.org/blog.dim.xml"/>
			<id>http://blog.tapoueh.org/blog.dim.xml</id>
			<updated>2010-08-31T12:45:46+00:00</updated>
		</source>
	</entry>

	<entry xml:lang="en">
		<title type="html">PDXPUG August Meeting in two weeks</title>
		<link href="http://pugs.postgresql.org/node/1647"/>
		<id>http://pugs.postgresql.org/1647 at http://pugs.postgresql.org</id>
		<updated>2010-08-05T03:56:19+00:00</updated>
		<content type="html">&lt;p&gt;When:  7pm Aug 19th&lt;br /&gt;
Where:  FreeGeek, 1731 SE 10th Avenue&lt;br /&gt;
What: PL/Parrot and PL/Perl6 - Parrots and Butterflies in your Database&lt;br /&gt;
Who:  Jonathan &quot;Duke&quot; Leto&lt;/p&gt;
&lt;p&gt;PL/Parrot is the Parrot Virtual Machine, embedded into the PostgreSQL relational database. This means that any Parrot language has the opportunity to become a PostgreSQL Procedural Language (PL). PL/Parrot supports writing stored procedures in the following languages:&lt;/p&gt;
&lt;p&gt;   * PL/PIR(U) - Parrot Intermediate Representation (PIR)&lt;br /&gt;
   * PL/Perl6(U) - Rakudo Perl 6&lt;/p&gt;
&lt;p&gt;This talk will give a quick introduction to Parrot VM and Rakudo Perl 6, and why you would want them in your database, including a status update of the current feature set of PL/Parrot and PL/Perl6. Example stored procedures in each language will be shown and, time permitting, the internals of how PL/Parrot works will be described. More information can be found at &lt;a href=&quot;http://pl.parrot.org&quot; title=&quot;http://pl.parrot.org&quot;&gt;http://pl.parrot.org&lt;/a&gt; .&lt;/p&gt;
&lt;p&gt;--&lt;/p&gt;
&lt;p&gt;Jonathan is an open source hacker who currently focuses on the Parrot Virtual Machine and Rakudo Perl 6, as well as being the maintainer of many CPAN modules. He has been involved with Google Summer of Code since 2008 and is currently organization administrator for The Perl Foundation and Parrot Foundation, as well as a mentor for RTEMS on Parrot. Jonathan received a masters in mathematics from University of Central Florida and has published several papers in the field of differential equations. He enjoys discovering wheels within wheels.&lt;/p&gt;</content>
		<author>
			<name>PDXPUG</name>
			<uri>http://pugs.postgresql.org/blog/19</uri>
		</author>
		<source>
			<title type="html">gabrielle's blog</title>
			<link rel="self" href="http://pugs.postgresql.org/blog/19/feed"/>
			<id>http://pugs.postgresql.org/blog/19/feed</id>
			<updated>2010-09-02T14:15:06+00:00</updated>
		</source>
	</entry>

	<entry>
		<title type="html">PGXN Blog and Twitterstream</title>
		<link href="http://feedproxy.google.com/~r/justatheory/pgsum/~3/0X0tHR3wYco/blog-twitterstream.html"/>
		<id>tag:justatheory.com,2010:/computers/databases/postgresql/pgxn/blog-twitterstream</id>
		<updated>2010-08-04T16:51:00+00:00</updated>
		<content type="html" xml:lang="en-us">&lt;div&gt;&lt;p&gt;I crated the &lt;a href=&quot;http://blog.pgxn.org/&quot;&gt;PGXN Blog&lt;/a&gt; yesterday. Tune in there for news and announcements. I’ll also be posting status reports once development gets underway, so that all you fans out there can follow my progress. Once the site is done (or at 1.0 anyway), the blog will be used for announcements, discussion of support issues, etc. So tune in!&lt;/p&gt;&lt;p&gt;&lt;a href=&quot;http://justatheory.com/computers/databases/postgresql/pgxn/blog-twitterstream.html&quot;&gt;Read More »&lt;/a&gt;&lt;/p&gt;&lt;img src=&quot;http://feeds.feedburner.com/~r/justatheory/pgsum/~4/0X0tHR3wYco&quot; height=&quot;1&quot; width=&quot;1&quot; /&gt;&lt;/div&gt;</content>
		<author>
			<name>David E. Wheeler</name>
			<uri>http://justatheory.com</uri>
		</author>
		<source>
			<title type="html">Just a Theory</title>
			<subtitle type="html">Theory waxes practical. By David Wheeler.</subtitle>
			<link rel="self" href="http://feeds2.feedburner.com/justatheory/pgsum"/>
			<id>tag:justatheory.com,2010:/computers/databases</id>
			<updated>2010-08-30T15:30:50+00:00</updated>
		</source>
	</entry>

	<entry xml:lang="en-us">
		<title type="html">Finding Xmax</title>
		<link href="http://momjian.us/main/blogs/pgblog/2010.html#August_4_2010_3"/>
		<id>http://momjian.us/main/blogs/pgblog/2010.html#August_4_2010_3</id>
		<updated>2010-08-04T16:00:00+00:00</updated>
		<content type="html">&lt;p&gt;Postgres implements &lt;a class=&quot;txt2html&quot; href=&quot;http://www.postgresql.org/docs/9.0/static/mvcc-intro.html&quot;&gt;Multiversion Concurrency Control (MVCC)&lt;/a&gt; using several
normally-invisible fields, notably &lt;em&gt;xmin&lt;/em&gt; and &lt;em&gt;xmax&lt;/em&gt;.  The xmin column
&lt;a class=&quot;txt2html&quot; href=&quot;http://www.postgresql.org/docs/9.0/static/storage-page-layout.html&quot;&gt;records&lt;/a&gt; the transaction id that created the row, and xmax records
the transaction id that expired the row, either through an UPDATE or DELETE.
&lt;/p&gt;
&lt;p&gt;I often demonstrate MVCC by showing the xmin and xmax columns:
&lt;/p&gt;
&lt;pre class=&quot;quote_explicit&quot;&gt;
        SELECT xmin, xmax FROM mytable;
         xmin | xmax
        ------+------
          664 |    0
        (1 row)
&lt;/pre&gt;

&lt;p&gt;&lt;a href=&quot;http://momjian.us/main/blogs/pgblog/2010.html#August_4_2010_3&quot;&gt;Continue Reading &amp;raquo;&lt;/a&gt;&lt;/p&gt;</content>
		<author>
			<name>Bruce Momjian</name>
			<email>bruce@momjian.us</email>
			<uri>http://momjian.us/main/blogs/pgblog.html</uri>
		</author>
		<source>
			<title type="html">Bruce Momjian: Postgres Blog</title>
			<subtitle type="html">Bruce Momjian: Postgres Blog</subtitle>
			<link rel="self" href="http://momjian.us/main/rss/pgblog.xml"/>
			<id>http://momjian.us/main/rss/pgblog.xml</id>
			<updated>2010-08-17T12:30:10+00:00</updated>
		</source>
	</entry>

	<entry xml:lang="en-us">
		<title type="html">Reliability Humor</title>
		<link href="http://momjian.us/main/blogs/pgblog/2010.html#August_4_2010_2"/>
		<id>http://momjian.us/main/blogs/pgblog/2010.html#August_4_2010_2</id>
		<updated>2010-08-04T16:00:00+00:00</updated>
		<content type="html">&lt;p&gt;As a followup to my previous blog &lt;a class=&quot;txt2html&quot; href=&quot;http://momjian.us/main/blogs/pgblog/2010.html#August_4_2010&quot;&gt;post&lt;/a&gt;, this humorous Slashdot
&lt;a class=&quot;txt2html&quot; href=&quot;http://hardware.slashdot.org/comments.pl?sid=1710324&amp;amp;cid=32821304&quot;&gt;comment&lt;/a&gt; under the title &quot;Reliability&quot; warrants coverage:
&lt;/p&gt;
&lt;p&gt;&lt;blockquote&gt;
&lt;p&gt;&lt;a href=&quot;http://momjian.us/main/blogs/pgblog/2010.html#August_4_2010_2&quot;&gt;Continue Reading &amp;raquo;&lt;/a&gt;&lt;/p&gt;&lt;/blockquote&gt;&lt;/p&gt;</content>
		<author>
			<name>Bruce Momjian</name>
			<email>bruce@momjian.us</email>
			<uri>http://momjian.us/main/blogs/pgblog.html</uri>
		</author>
		<source>
			<title type="html">Bruce Momjian: Postgres Blog</title>
			<subtitle type="html">Bruce Momjian: Postgres Blog</subtitle>
			<link rel="self" href="http://momjian.us/main/rss/pgblog.xml"/>
			<id>http://momjian.us/main/rss/pgblog.xml</id>
			<updated>2010-08-17T12:30:10+00:00</updated>
		</source>
	</entry>

	<entry xml:lang="en-us">
		<title type="html">Database Reliability</title>
		<link href="http://momjian.us/main/blogs/pgblog/2010.html#August_4_2010"/>
		<id>http://momjian.us/main/blogs/pgblog/2010.html#August_4_2010</id>
		<updated>2010-08-04T16:00:00+00:00</updated>
		<content type="html">&lt;p&gt;The database is usually a critical piece of infrastructure in an organization;  when the database is down, many things stop working, so
database reliability is often a serious concern.  While the reliability of database software is important, for Postgres it is often the
infrastructure that Postgres depends on that causes outages, not Postgres itself.  We see this regularly on the Postgres email lists.
&lt;/p&gt;
&lt;p&gt;To get started, a fundamental assumption has to be discarded &amp;mdash; that computers are abstract machines and always do what they are told. 
While we often treat hardware as abstract devices, in reality they are physical, and are susceptible to failure just like any physical
entity.
&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://momjian.us/main/blogs/pgblog/2010.html#August_4_2010&quot;&gt;Continue Reading &amp;raquo;&lt;/a&gt;&lt;/p&gt;</content>
		<author>
			<name>Bruce Momjian</name>
			<email>bruce@momjian.us</email>
			<uri>http://momjian.us/main/blogs/pgblog.html</uri>
		</author>
		<source>
			<title type="html">Bruce Momjian: Postgres Blog</title>
			<subtitle type="html">Bruce Momjian: Postgres Blog</subtitle>
			<link rel="self" href="http://momjian.us/main/rss/pgblog.xml"/>
			<id>http://momjian.us/main/rss/pgblog.xml</id>
			<updated>2010-08-17T12:30:10+00:00</updated>
		</source>
	</entry>

	<entry xml:lang="en">
		<title type="html">Customizing the RPMs from pgrpms.org</title>
		<link href="http://www.chesnok.com/daily/2010/08/03/customizing-the-rpms-from-pgrpms-org/"/>
		<id>http://www.chesnok.com/daily/?p=1862</id>
		<updated>2010-08-04T00:33:57+00:00</updated>
		<content type="html">&lt;p&gt;To pick up &lt;a href=&quot;http://people.planetpostgresql.org/devrim/index.php?/archives/44-How-To-Build-Your-Own-PostgreSQL-and-related-software-RPMs-on-CentOSRHELFedora.html&quot;&gt;where Devrim left off&lt;/a&gt; in customizing RPMs, here are some more tips for getting your very own RPMs built:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Create a VM with your favorite operating system (I&amp;#8217;m using versions of CentOS). I need both 32-bit OS and 64-bit OS. This is much easier to manage with separate, local VMs.
&lt;/li&gt;
&lt;li&gt;Install spectool (&lt;a href=&quot;http://packages.sw.be/spectool/&quot;&gt;available here&lt;/a&gt;), and SVN
&lt;/li&gt;
&lt;li&gt;The other dependancies were: gcc glibc-devel bison flex python-devel tcl-devel readline-devel zlib-devel openssl-devel krb5-devel e2fsprocs-devel libxml2-devel libxslt-devel pam-devel
&lt;/li&gt;
&lt;li&gt;Edit the postgresql-$VERSION.spec file to your liking: If you&amp;#8217;re adding patches, you need to add them in TWO places &amp;#8211; first in the Patch#: group, and then again below where the %patch# series starts. Finally, if you&amp;#8217;re adding an entirely new package (say in 8.2, pg_standby in contrib), you&amp;#8217;ll need to also add the binary (or library, or whatever) to the appropriate %files clause later in the spec file.  It&amp;#8217;s also a good idea to modify &amp;#8216;Release&amp;#8217;. Here&amp;#8217;s a sample diff of my spec file:
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;code&gt;&lt;br /&gt;
--- postgresql-8.2.spec (revision 188)&lt;br /&gt;
+++ postgresql-8.2.spec (working copy)&lt;br /&gt;
@@ -74,7 +74,7 @@&lt;br /&gt;
 Summary:       PostgreSQL client programs and libraries&lt;br /&gt;
 Name:          postgresql&lt;br /&gt;
 Version:       8.2.17&lt;br /&gt;
-Release:       1PGDG%{?dist}&lt;br /&gt;
+Release:       1test%{?dist}&lt;br /&gt;
 License:       BSD&lt;br /&gt;
 Group:         Applications/Databases&lt;br /&gt;
 Url:           http://www.postgresql.org/&lt;br /&gt;
@@ -95,7 +95,9 @@&lt;br /&gt;
 Patch4:                postgresql-test.patch&lt;br /&gt;
 Patch6:                postgresql-perl-rpath.patch&lt;br /&gt;
 Patch8:                postgresql-prefer-ncurses.patch&lt;br /&gt;
+Patch7:                postgresql-pgstat-dir.patch&lt;br /&gt;
 Patch9:                postgresql-use-zoneinfo.patch&lt;br /&gt;
+Patch10:               pg_standby.patch&lt;/code&gt;&lt;/p&gt;
&lt;p&gt; Buildrequires: perl glibc-devel bison flex&lt;br /&gt;
 Requires:      /sbin/ldconfig initscripts&lt;br /&gt;
@@ -282,7 +284,9 @@&lt;br /&gt;
 %patch4 -p1&lt;br /&gt;
 %patch6 -p1&lt;br /&gt;
 %patch8 -p1&lt;br /&gt;
+%patch7 -p1&lt;br /&gt;
 %patch9 -p1&lt;br /&gt;
+%patch10 -p1&lt;/p&gt;
&lt;p&gt; pushd doc&lt;br /&gt;
 tar -zcf postgres.tar.gz *.html stylesheet.css&lt;br /&gt;
@@ -604,6 +608,7 @@&lt;br /&gt;
 %{_bindir}/pg_controldata&lt;br /&gt;
 %{_bindir}/pg_ctl&lt;br /&gt;
 %{_bindir}/pg_resetxlog&lt;br /&gt;
+%{_bindir}/pg_standby&lt;br /&gt;
 %{_bindir}/postgres&lt;br /&gt;
 %{_bindir}/postmaster&lt;br /&gt;
 %{_mandir}/man1/initdb.*&lt;br /&gt;
&lt;/p&gt;
&lt;p&gt;How have you customized RPMs using this repo? Share your .spec files!&lt;/p&gt;


&lt;p&gt;Related posts:&lt;ol&gt;&lt;li&gt;&lt;a href=&quot;http://www.chesnok.com/daily/2010/05/20/need-reviewers-preparing-for-the-first-commitfest-for-9-1/&quot; rel=&quot;bookmark&quot; title=&quot;Permanent Link: Need reviewers &amp;#8211; preparing for the first commitfest for 9.1&quot;&gt;Need reviewers &amp;#8211; preparing for the first commitfest for 9.1&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://www.chesnok.com/daily/2010/08/29/using-logger-with-pg_standby/&quot; rel=&quot;bookmark&quot; title=&quot;Permanent Link: Using logger with pg_standby&quot;&gt;Using logger with pg_standby&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://www.chesnok.com/daily/2009/09/18/user-group-idea-patch-review-party/&quot; rel=&quot;bookmark&quot; title=&quot;Permanent Link: User Group Idea: Patch Review Party&quot;&gt;User Group Idea: Patch Review Party&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;&lt;/p&gt;</content>
		<author>
			<name>selena</name>
			<uri>http://www.chesnok.com/daily</uri>
		</author>
		<source>
			<title type="html">tending the garden</title>
			<subtitle type="html">selena marie deckelmann's blog</subtitle>
			<link rel="self" href="http://www.chesnok.com/daily/feed/atom/"/>
			<id>http://www.chesnok.com/daily/feed/atom/</id>
			<updated>2010-09-02T14:30:47+00:00</updated>
		</source>
	</entry>

	<entry xml:lang="en-us">
		<title type="html">Development Process Article</title>
		<link href="http://momjian.us/main/blogs/pgblog/2010.html#August_3_2010_3"/>
		<id>http://momjian.us/main/blogs/pgblog/2010.html#August_3_2010_3</id>
		<updated>2010-08-03T16:00:00+00:00</updated>
		<content type="html">&lt;p&gt;I wrote an article about the Postgres development process for the &lt;a class=&quot;txt2html&quot; href=&quot;http://www.postgresql.jp/&quot;&gt;Japan PostgreSQL Users Group&lt;/a&gt; (JPUG) and
they have now published it in &lt;a class=&quot;major&quot; href=&quot;http://lets.postgresql.jp/documents/tutorial/postgres-dev-process/en/&quot;&gt;English&lt;/a&gt; and
&lt;a class=&quot;major&quot; href=&quot;http://lets.postgresql.jp/documents/tutorial/postgres-dev-process/ja&quot;&gt;Japanese&lt;/a&gt;.  It highlights many of the processes that make
Postgres open source development different, frustrating, and effective, with section titles like &quot;No Single Authority&quot;, &quot;No Bug Tracking
System&quot;, and &quot;No Development Roadmap&quot;. &lt;img src=&quot;http://momjian.us/main/img/blog/wink.png&quot; /&gt;
&lt;/p&gt;</content>
		<author>
			<name>Bruce Momjian</name>
			<email>bruce@momjian.us</email>
			<uri>http://momjian.us/main/blogs/pgblog.html</uri>
		</author>
		<source>
			<title type="html">Bruce Momjian: Postgres Blog</title>
			<subtitle type="html">Bruce Momjian: Postgres Blog</subtitle>
			<link rel="self" href="http://momjian.us/main/rss/pgblog.xml"/>
			<id>http://momjian.us/main/rss/pgblog.xml</id>
			<updated>2010-08-17T12:30:10+00:00</updated>
		</source>
	</entry>

	<entry xml:lang="en-us">
		<title type="html">Form Follows Failure</title>
		<link href="http://momjian.us/main/blogs/pgblog/2010.html#August_3_2010_2"/>
		<id>http://momjian.us/main/blogs/pgblog/2010.html#August_3_2010_2</id>
		<updated>2010-08-03T16:00:00+00:00</updated>
		<content type="html">&lt;p&gt;While Steve Jobs tried to blame everyone but Apple for poor iPhone 4 reception, this
&lt;a class=&quot;major&quot; href=&quot;http://www.theatlantic.com/science/archive/2010/07/why-apples-bad-week-may-be-good-news-for-iphones/59914/&quot;&gt;article&lt;/a&gt; calls this
long-term good news for the iPhone and smartphones in general because smartphone designers will increase their focus on call quality. 
This mirrors the competing interests that are often involved in technological progress:
&lt;/p&gt;
&lt;p&gt;&lt;blockquote&gt;
&quot;Almost everything about technology, to me, is a response to a negative. Something isn't working right. Something doesn't look right.
Something doesn't perform right,&quot; Petroski told me. &quot;And you try to remove that negative quality and that change is presumably an
improvement. But then you release the new and improved product and people find faults with it. Because nothing is perfect. You always have
competing constraints.&quot; 
&lt;/blockquote&gt;
&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://momjian.us/main/blogs/pgblog/2010.html#August_3_2010_2&quot;&gt;Continue Reading &amp;raquo;&lt;/a&gt;&lt;/p&gt;</content>
		<author>
			<name>Bruce Momjian</name>
			<email>bruce@momjian.us</email>
			<uri>http://momjian.us/main/blogs/pgblog.html</uri>
		</author>
		<source>
			<title type="html">Bruce Momjian: Postgres Blog</title>
			<subtitle type="html">Bruce Momjian: Postgres Blog</subtitle>
			<link rel="self" href="http://momjian.us/main/rss/pgblog.xml"/>
			<id>http://momjian.us/main/rss/pgblog.xml</id>
			<updated>2010-08-17T12:30:10+00:00</updated>
		</source>
	</entry>

	<entry xml:lang="en-us">
		<title type="html">ORMs and Their Discontents</title>
		<link href="http://momjian.us/main/blogs/pgblog/2010.html#August_3_2010"/>
		<id>http://momjian.us/main/blogs/pgblog/2010.html#August_3_2010</id>
		<updated>2010-08-03T16:00:00+00:00</updated>
		<content type="html">&lt;p&gt;&lt;a class=&quot;txt2html&quot; href=&quot;http://en.wikipedia.org/wiki/Object-relational_mapping&quot;&gt;Object-Relational Mappers&lt;/a&gt; are often a hot topic of discussion among database
geeks.  At OSCON's PGDay this year, Christophe Pettus &lt;a class=&quot;major&quot; href=&quot;http://thebuild.com/blog/2010/07/18/orms-and-their-discontents-2/&quot;&gt;presented&lt;/a&gt;
the clearest explanation I have ever heard of the complexities of ORMs and the basically unattainable expectations users have for them. 
The basic problem is that it is easy to map simple ORM operations into SQL, but complex cases and mass changes require access to SQL for
performance.  Christophe explained why ORMs increase programmer productivity, but also why ORMs will never be able to do everything SQL
can, so organizations should be prepared to add SQL to their ORM systems where appropriate.
&lt;/p&gt;
&lt;p&gt;A video recording was made of this talk and hopefully it will be posted soon.
&lt;/p&gt;
&lt;a href=&quot;http://momjian.us/main/comment_item.html?/main/blogs/pgblog.html/August_3_2010&quot;&gt;View Comments&lt;/a&gt;&lt;br /&gt;</content>
		<author>
			<name>Bruce Momjian</name>
			<email>bruce@momjian.us</email>
			<uri>http://momjian.us/main/blogs/pgblog.html</uri>
		</author>
		<source>
			<title type="html">Bruce Momjian: Postgres Blog</title>
			<subtitle type="html">Bruce Momjian: Postgres Blog</subtitle>
			<link rel="self" href="http://momjian.us/main/rss/pgblog.xml"/>
			<id>http://momjian.us/main/rss/pgblog.xml</id>
			<updated>2010-08-17T12:30:10+00:00</updated>
		</source>
	</entry>

	<entry xml:lang="en">
		<title type="html">Not impressed</title>
		<link href="http://people.planetpostgresql.org/andrew/index.php?/archives/97-Not-impressed.html"/>
		<id>http://people.planetpostgresql.org/andrew/index.php?/archives/97-guid.html</id>
		<updated>2010-08-02T23:20:37+00:00</updated>
		<content type="html">Last Friday the CEO of Continuent sent out an apology for spamming the PostgreSQL community. Leaving aside the fact that the apology was issued on the postgresql-www mailing list, which is hardly the right forum, his apology left quite a number of questions unanswered. Many of those questions were subsequently asked explicitly by &lt;a href=&quot;http://archives.postgresql.org/pgsql-www/2010-07/msg00085.php&quot;&gt;Robert Haas&lt;/a&gt;. So far there has been no response.&lt;br /&gt;
&lt;br /&gt;
Also, it doesn't explain why I was spammed today, three days after the apology was issued.&lt;br /&gt;
&lt;br /&gt;
Right now I'm thinking of putting Continuent on my automatic delete list. &lt;br /&gt;
&lt;br /&gt;
I'm certainly not impressed by their technical expertise if they can't even get this right.</content>
		<author>
			<name>Andrew Dunstan</name>
			<email>nospam@example.com</email>
			<uri>http://people.planetpostgresql.org/andrew/</uri>
		</author>
		<source>
			<title type="html">Andrew's PostgreSQL blog</title>
			<subtitle type="html">My little place on the web...</subtitle>
			<link rel="self" href="http://people.planetpostgresql.org/andrew/index.php?/feeds/index.rss2"/>
			<id>http://people.planetpostgresql.org/andrew/index.php?/feeds/index.rss2</id>
			<updated>2010-08-23T21:45:28+00:00</updated>
		</source>
	</entry>

	<entry>
		<title type="html">Cleaning up the Oracle mess</title>
		<link href="http://pgsnake.blogspot.com/2010/07/cleaning-up-oracle-mess.html"/>
		<id>tag:blogger.com,1999:blog-3645070705954691807.post-7233818947197372515</id>
		<updated>2010-07-30T18:11:55+00:00</updated>
		<content type="html">I've been caught off-guard by the number of &lt;a href=&quot;http://www.itnews.com.au/News/221051,oracle-shuts-down-open-source-test-servers.aspx&quot;&gt;news&lt;/a&gt; &lt;a href=&quot;http://www.h-online.com/open/news/item/Report-Oracle-shuts-down-PostgreSQL-test-servers-1047676.html&quot;&gt;stories&lt;/a&gt; that have been posted about Oracle turning off their Solaris boxes that participated in the &lt;a href=&quot;http://pgbuildfarm.org/&quot;&gt;PostgreSQL Buildfarm&lt;/a&gt;&amp;nbsp;and the fact that I've been working to replace them. I think most of us in the community assumed it was going to happen sooner or later - Sun were contributors to PostgreSQL, but once they bought MySQL I think it was the beginning of the end of their contributions to the project. Being&amp;nbsp;acquired&amp;nbsp;by Oracle was the solid-gold nail in the coffin.&lt;br /&gt;&lt;br /&gt;Anyway, just to clarify a few points in some of the articles I've seen:&lt;br /&gt;&lt;ol&gt;&lt;li&gt;My employer and corporate contributor to PostgreSQL, &lt;a href=&quot;http://www.enterprisedb.com/&quot;&gt;EnterpriseDB&lt;/a&gt; is providing the hardware for the new buildfarm members. We try to give back to the community wherever we can, and this is one thing that we can do quite easily.&lt;br /&gt;&amp;nbsp; &lt;/li&gt;&lt;li&gt;So far I've enabled two Solaris SPARC buildfarm members, one running the Sun Studio compiler, and one using GCC. There are equivalent Solaris Intel members being setup at the moment, as well as a couple of Windows 7 ones using VC++ 2008 32 and 64 bit.&lt;br /&gt;&amp;nbsp;&lt;/li&gt;&lt;li&gt;Contrary to reports and what might be inferred from the short bio on my blog, I actually work for EnterpriseDB on a full time basis. The &quot;in my spare time I work for...&quot; bit was my poor British attempt at humour. Sorry 'bout that - it won't happen again!&lt;/li&gt;&lt;/ol&gt;&lt;div&gt;Well, that's about it I guess. We now return you to your scheduled programming.&lt;/div&gt;&lt;div class=&quot;blogger-post-footer&quot;&gt;&lt;img width=&quot;1&quot; height=&quot;1&quot; src=&quot;https://blogger.googleusercontent.com/tracker/3645070705954691807-7233818947197372515?l=pgsnake.blogspot.com&quot; alt=&quot;&quot; /&gt;&lt;/div&gt;</content>
		<author>
			<name>Dave Page</name>
			<email>dpage@pgadmin.org</email>
			<uri>http://pgsnake.blogspot.com/</uri>
		</author>
		<source>
			<title type="html">Dave's Postgres Blog</title>
			<subtitle type="html">Postgres related musings and ramblings</subtitle>
			<link rel="self" href="http://pgsnake.blogspot.com/feeds/posts/default"/>
			<id>tag:blogger.com,1999:blog-3645070705954691807</id>
			<updated>2010-08-30T09:45:05+00:00</updated>
		</source>
	</entry>

	<entry xml:lang="en-us">
		<title type="html">The Pain of Software Development</title>
		<link href="http://momjian.us/main/blogs/pgblog/2010.html#July_30_2010"/>
		<id>http://momjian.us/main/blogs/pgblog/2010.html#July_30_2010</id>
		<updated>2010-07-30T16:00:00+00:00</updated>
		<content type="html">&lt;p&gt;Adding features to Postgres is often a frustrating experience for all involved.  Some features are clear-cut, but many are subject to
interpretation and involve much email discussion.  The email discussion is often draining, but this
&lt;a class=&quot;major&quot; href=&quot;http://tech.slashdot.org/comments.pl?sid=1276637&amp;amp;cid=28414607&quot;&gt;comment&lt;/a&gt; from a Slashdot
&lt;a class=&quot;txt2html&quot; href=&quot;http://tech.slashdot.org/story/09/06/21/2042245/Does-the-Linux-Desktop-Innovate-Too-Much&quot;&gt;thread&lt;/a&gt; about Linux desktop innovation is
illuminating.  The comment is about human interface engineereers asking for tiny application changes to improve usability, and while the
application developer was originally &quot;distracted trying to decide a fitting way to end the e-mail authors life&quot;, he ultimately agreed that
the changes improved the user experience.  I think Postgres developers often feel the same way.
&lt;/p&gt;
&lt;a href=&quot;http://momjian.us/main/comment_item.html?/main/blogs/pgblog.html/July_30_2010&quot;&gt;View Comments&lt;/a&gt;&lt;br /&gt;</content>
		<author>
			<name>Bruce Momjian</name>
			<email>bruce@momjian.us</email>
			<uri>http://momjian.us/main/blogs/pgblog.html</uri>
		</author>
		<source>
			<title type="html">Bruce Momjian: Postgres Blog</title>
			<subtitle type="html">Bruce Momjian: Postgres Blog</subtitle>
			<link rel="self" href="http://momjian.us/main/rss/pgblog.xml"/>
			<id>http://momjian.us/main/rss/pgblog.xml</id>
			<updated>2010-08-17T12:30:10+00:00</updated>
		</source>
	</entry>

	<entry xml:lang="en">
		<title type="html">Explain Plans PostgreSQL 9.0 Text, JSON, XML, YAML - Part 1: You Choose</title>
		<link href="http://www.postgresonline.com/journal/archives/171-Explain-Plans-PostgreSQL-9.0-Text,-JSON,-XML,-YAML-Part-1-You-Choose.html"/>
		<id>http://www.postgresonline.com/journal/archives/171-guid.html</id>
		<updated>2010-07-29T21:58:03+00:00</updated>
		<content type="html">&lt;p&gt;One of the new features of PostgreSQL 9.0 is the ability to specify the format of an explain plan.
In prior versions your only choice was text (and graphic explain with tools like PgAdmin III and other GUIS), but in 9.0 on, you have the additional options of
Javascript Object Notation (JSON) which &lt;a href=&quot;http://lin-ear-th-inking.blogspot.com/2010/07/is-json-csv-of-21st-century.html&quot; target=&quot;_blank&quot;&gt;some people have a thing or two to say about them&lt;/a&gt;,  YAML Ain't Markup Language (YAML) or eXtended Markup Language (XML). The new explain options are itemized in &lt;a href=&quot;http://www.postgresql.org/docs/9.0/static/sql-explain.html&quot; target=&quot;_blank&quot;&gt;PostgreSQL 9.0 EXPLAIN&lt;/a&gt;.
&lt;/p&gt;
&lt;p&gt;The main benefit of the JSON, XML, YAML formats is that they are easier
to machine parse than the default text version. This will allow for creative renderings of planner trees with minimal coding.&lt;/p&gt;

&lt;p&gt;In Part 1 of this series, we'll demonstrate how to output the plans in these various formats and what they look like.
In later parts of this series -- we'll demonstrate how to use Javascript, XSL and other scripting/markup languages
to transform these into works of art you can hang on your wall.&lt;/p&gt;

-- START POSTGIS IN ACTION ASIDE --
&lt;p&gt;We just submitted the third major revision of &lt;a href=&quot;http://www.postgis.us/chapter_03&quot; target=&quot;_blank&quot;&gt;Chapter 3 Data Modeling&lt;/a&gt;
of our upcoming &lt;a href=&quot;http://www.postgis.us&quot; target=&quot;_blank&quot;&gt;PostGIS in Action&lt;/a&gt; book. 
The second major revision we never submitted and threw it out because it wasn't worldly enough and was too involved. We may
use it later on for an example.
Chapter 3 should be up on Manning Early Access Program (MEAP) soon. If you haven't bought the book yet &lt;a href=&quot;http://www.postgis.us/page_buy_book&quot;&gt;Buy now&lt;/a&gt;.
You don't want to miss out on a major masterpiece in the making. Okay we exaggerate a bit.&lt;/p&gt;
-- END POSTGIS IN ACTION ASIDE -- &lt;br /&gt;&lt;a href=&quot;http://www.postgresonline.com/journal/archives/171-Explain-Plans-PostgreSQL-9.0-Text,-JSON,-XML,-YAML-Part-1-You-Choose.html#extended&quot;&gt;Continue reading &quot;Explain Plans PostgreSQL 9.0 Text, JSON, XML, YAML - Part 1: You Choose&quot;&lt;/a&gt;</content>
		<author>
			<name>Leo Hsu and Regina Obe</name>
			<email>nospam@example.com</email>
			<uri>http://www.postgresonline.com/journal/</uri>
		</author>
		<source>
			<title type="html">Postgres OnLine Journal</title>
			<subtitle type="html">an In depth look at the PostgreSQL open source database</subtitle>
			<link rel="self" href="http://www.postgresonline.com/journal/index.php?/feeds/index.rss2"/>
			<id>http://www.postgresonline.com/journal/index.php?/feeds/index.rss2</id>
			<updated>2010-08-29T17:15:10+00:00</updated>
		</source>
	</entry>

	<entry xml:lang="en">
		<title type="html">We make the big time!</title>
		<link href="http://people.planetpostgresql.org/andrew/index.php?/archives/96-We-make-the-big-time!.html"/>
		<id>http://people.planetpostgresql.org/andrew/index.php?/archives/96-guid.html</id>
		<updated>2010-07-29T17:16:02+00:00</updated>
		<content type="html">Australian IT News has &lt;a href=&quot;http://www.itnews.com.au/News/221051,oracle-shuts-down-open-source-test-servers.aspx&quot;&gt;picked up&lt;/a&gt; on my recent post about Oracle shutting down their buildfarm servers. It's good publicity for PostgreSQL but I doubt it will shame them into continuing to support us.&lt;br /&gt;
&lt;br /&gt;
Meanwhile, EnterpriseDB through Dave Page have added some more Solaris members. Thanks, guys.</content>
		<author>
			<name>Andrew Dunstan</name>
			<email>nospam@example.com</email>
			<uri>http://people.planetpostgresql.org/andrew/</uri>
		</author>
		<source>
			<title type="html">Andrew's PostgreSQL blog</title>
			<subtitle type="html">My little place on the web...</subtitle>
			<link rel="self" href="http://people.planetpostgresql.org/andrew/index.php?/feeds/index.rss2"/>
			<id>http://people.planetpostgresql.org/andrew/index.php?/feeds/index.rss2</id>
			<updated>2010-08-23T21:45:28+00:00</updated>
		</source>
	</entry>

	<entry>
		<title type="html">Distributed Transactions and Two-Phase Commit</title>
		<link href="http://blog.endpoint.com/2010/07/distributed-transactions-and-two-phase.html"/>
		<id>tag:blogger.com,1999:blog-7997313029981170997.post-5796856138732355755</id>
		<updated>2010-07-29T17:46:15+00:00</updated>
		<content type="html">&lt;p&gt;The typical example of a transaction involves Alice and Bob, and their bank. Alice pays Bob $100, and the bank needs to debit Alice and credit Bob. Easy enough, provided the server doesn't crash. But what happens if the bank debits Alice, and then before crediting Bob, the server goes down? Or what if they credit Bob first, and then try to debit Alice only to find she doesn't have enough funds? A transaction allows the debit and credit operations to happen as a package (&quot;atomically&quot; is the word commonly used), so either both operations happen or neither happens, even if the server crashes halfway through the transaction. That way the bank never credits Bob without debiting Alice, or vice versa.&lt;/p&gt;
&lt;a href=&quot;http://2.bp.blogspot.com/_Q7kwFwwUJ0o/TFHnqrwIiQI/AAAAAAAAAU8/pAJGBOmvUHE/s1600/one_db.png&quot;&gt;&lt;img src=&quot;http://2.bp.blogspot.com/_Q7kwFwwUJ0o/TFHnqrwIiQI/AAAAAAAAAU8/pAJGBOmvUHE/s320/one_db.png&quot; border=&quot;0&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5499431340481218818&quot; /&gt;&lt;/a&gt;
&lt;p&gt;That's simple enough, but the situation can become more complex. What if, for instance, for buzzword-compliance purposes, the bank has &quot;sharded&quot; its accounts database by splitting it in pieces and putting each piece on a different server (whether this is would be smart or not is outside the scope of this post). The typical transaction handles statements issued only for one database, so we can't wrap the debit and credit operations within a single BEGIN/COMMIT if Alice's account information lives on one server and Bob's lives on another.&lt;/p&gt;
&lt;a href=&quot;http://2.bp.blogspot.com/_Q7kwFwwUJ0o/TFHm0FUCvvI/AAAAAAAAAU0/vj0nnTLwfkc/s1600/shard1.png&quot;&gt;&lt;img src=&quot;http://2.bp.blogspot.com/_Q7kwFwwUJ0o/TFHm0FUCvvI/AAAAAAAAAU0/vj0nnTLwfkc/s320/shard1.png&quot; border=&quot;0&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5499430402449915634&quot; /&gt;&lt;/a&gt;
&lt;p&gt; Enter &quot;distributed transactions&quot;. A distributed transaction allows applications to group multiple transaction-aware systems into a single transaction. These systems might be different databases, or they might include other systems such as message queues, in which case the transaction concept means a message would get delivered if and only if the rest of the transaction completed. So with a distributed transaction, the bank could debit Alice's account in one database and credit Bob's in another, atomically.&lt;/p&gt;
&lt;p&gt;All this comes at some cost. Distributed transactions require a &quot;transaction manager&quot;, an application which handles the special semantics required to commit a distributed transaction. Second, the systems involved must support &quot;two-phase commit&quot; (which was added to PostgreSQL in version 8.1). Distributed transactions are committed using PREPARE TRANSACTION 'foo' (phase 1), and COMMIT PREPARED 'foo' or ROLLBACK PREPARED 'foo' (phase 2), rather than the usual COMMIT or ROLLBACK.&lt;/p&gt;
&lt;a href=&quot;http://3.bp.blogspot.com/_Q7kwFwwUJ0o/TFHmiW6OA9I/AAAAAAAAAUs/s9SUT5uxmcI/s1600/xact_mgr.png&quot;&gt;&lt;img src=&quot;http://3.bp.blogspot.com/_Q7kwFwwUJ0o/TFHmiW6OA9I/AAAAAAAAAUs/s9SUT5uxmcI/s320/xact_mgr.png&quot; border=&quot;0&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5499430097935795154&quot; /&gt;&lt;/a&gt;
&lt;p&gt;The beginning of a distributed transaction looks just like any other transaction: the application issues a BEGIN statement (optional in PostgreSQL), followed by normal SQL statements. When the transaction manager is instructed to commit, it runs the first commit phase by saying &quot;PREPARE TRANSACTION 'foo'&quot; (where &quot;foo&quot; is some arbitrary identifier for this transaction) on each system involved in the distributed transaction. Each system does whatever it needs to do to determine whether or not this transaction can be committed and to make sure it can be committed even if the server crashes, and reports success or failure. If all systems succeed, the transaction manager follows up with &quot;COMMIT PREPARED 'foo'&quot;, and if a system reports failure, the transaction manager can roll back all the other systems using either ROLLBACK (for those transactions it hasn't yet prepared), or &quot;ROLLBACK PREPARED 'foo'&quot;. Using two-phase commit is obviously slower than committing transactions on only one database, but sometimes the data integrity it provides justifies the extra cost.&lt;/p&gt;
&lt;p&gt;In PostgreSQL, two-phase commit is supported provided max_prepared_transactions is nonzero. A PREPARE TRANSACTION statement persists the current transaction to disk, and  dissociates it from the current session. That way it can survive even if the database goes down. The current session no longer has an active transaction. However, the prepared transaction acts like any other open transaction in that all locks held by the prepared transaction remain held, and VACUUM cannot reclaim storage from that transaction. So it's not a good idea to leave prepared transactions open for a long time.&lt;/p&gt;
&lt;p&gt;Distributed transactions are most common, it seems, in Java applications. Full J2EE application servers typically come with a transaction manager component. For my examples I'll use an open source, standalone transaction manager, called &lt;a href=&quot;http://docs.codehaus.org/display/BTM/Home&quot;&gt;Bitronix&lt;/a&gt;. I'm not particularly fond of using Java for simple scripts, though, so I've used JRuby for this &lt;a href=&quot;http://josh.endpoint.com/bitronix.rb&quot;&gt;demonstration code&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;This script uses two databases, which I've called &quot;athos&quot; and &quot;porthos&quot;. Each has &lt;a href=&quot;http://josh.endpoint.com/athos.sql&quot;&gt;same schema&lt;/a&gt;, which provides a simple framework for the sharded bank example described above. This schema provides a table for account names, another for ledger information, and a simple trigger to raise an exception when a transaction would bring a person's balance below $0. I'll first populate athos with Alice's account information. She gets $200 to start. Bob will go in the porthos database, with no initial balance.&lt;/p&gt;

&lt;pre&gt;
5432 josh@athos# insert into accounts values ('Alice');
INSERT 0 1
5432 josh@athos*# insert into ledger values ('Alice', 200);
INSERT 0 1
5432 josh@athos*# commit;
COMMIT5432 josh@athos# \c porthos
You are now connected to database &quot;porthos&quot;.
5432 josh@porthos# insert into accounts values ('Bob');
INSERT 0 1
5432 josh@porthos*# commit;
COMMIT
&lt;/pre&gt;

&lt;p&gt;Use of Bitronix is pretty straightforward. After setting up a few constants for easier typing, I create a Bitronix data source for each PostgreSQL database. Here I have to use the PostgreSQL JDBC driver's org.postgresql.xa.PGXADataSource class; &quot;XA&quot; is Java's protocol for two-phase commit, and requires JDBC driver support. Here's the code for setting up one data source; the other is just the same.&lt;/p&gt;
&lt;pre&gt;
ds1 = PDS.new
ds1.set_class_name 'org.postgresql.xa.PGXADataSource'
ds1.set_unique_name 'pgsql1'
ds1.set_max_pool_size 3
ds1.get_driver_properties.set_property 'databaseName', 'athos'
ds1.get_driver_properties.set_property 'user', 'josh'
ds1.init
&lt;/pre&gt;
&lt;p&gt;Then I simply get a connection from each data source, instantiate a Bitronix TransactionManager object, and begin a transaction.&lt;/p&gt;
&lt;pre&gt;
c1 = ds1.get_connection
c2 = ds2.get_connection
btm = TxnSvc.get_transaction_manager
btm.begin
&lt;/pre&gt;
&lt;p&gt;Within my transaction, I just use normal JDBC commands to debit Alice and credit Bob, after which I commit the transaction through the TransactionManager object. If this transaction fails, it raises an exception, which I can capture using Ruby's begin/rescue exception handling, and roll back the transaction.&lt;/p&gt;
&lt;pre&gt;
begin
  s2 = c2.prepare_statement &quot;INSERT INTO ledger VALUES ('Bob', 100)&quot;
  s2.execute_update
  s2.close

  s1 = c1.prepare_statement &quot;INSERT INTO ledger VALUES ('Alice', -100)&quot;
  s1.execute_update
  s1.close

  btm.commit
  puts &quot;Successfully committed&quot;
rescue
  puts &quot;Something bad happened: &quot; + $!
  btm.rollback
end
&lt;/pre&gt;
&lt;p&gt;When I run this, Bitronix gives me a bunch of output, which I haven't bothered to suppress, but among it all is the &quot;Successfully committed&quot; string I told it to print on success. Since Alice is debited $100 each time we run this, and she started with $200, we can run it twice before hitting errors. On the third time, we get this:&lt;/p&gt;
&lt;pre&gt;
Something bad happened: org.postgresql.util.PSQLException: ERROR: Rejecting operation; account owner Alice's balance would drop below 0
&lt;/pre&gt;
&lt;p&gt;This is our trigger firing, to tell us that we can't debit Alice any more. If I look in the two databases, I can see that everything worked as planned:&lt;/p&gt;
&lt;pre&gt;
5432 josh@athos*# select get_balance('Alice');
 get_balance 
-------------
           0
(1 row)

5432 josh@athos*# \c porthos 
You are now connected to database &quot;porthos&quot;.
5432 josh@porthos# select get_balance('Bob');
 get_balance 
-------------
         200
(1 row)
&lt;/pre&gt;
&lt;p&gt;Remember I've run my script three times, but Bob has only been credited $200, because that's all Alice had to start with.&lt;/p&gt;&lt;div class=&quot;blogger-post-footer&quot;&gt;&lt;img width=&quot;1&quot; height=&quot;1&quot; src=&quot;https://blogger.googleusercontent.com/tracker/7997313029981170997-5796856138732355755?l=blog.endpoint.com&quot; alt=&quot;&quot; /&gt;&lt;/div&gt;</content>
		<author>
			<name>Joshua Tolley</name>
			<email>noreply@blogger.com</email>
			<uri>http://blog.endpoint.com/search/label/postgres</uri>
		</author>
		<source>
			<title type="html">End Point Blog</title>
			<subtitle type="html">Ongoing observations by End Point people.</subtitle>
			<link rel="self" href="http://blog.endpoint.com/feeds/posts/default/-/postgres/"/>
			<id>tag:blogger.com,1999:blog-7997313029981170997</id>
			<updated>2010-09-01T18:30:29+00:00</updated>
		</source>
	</entry>

	<entry>
		<title type="html">PostgreSQL and Flymake</title>
		<link href="http://petereisentraut.blogspot.com/2010/07/postgresql-and-flymake.html"/>
		<id>tag:blogger.com,1999:blog-5541296000399974369.post-7254060052395031757</id>
		<updated>2010-07-28T23:49:13+00:00</updated>
		<content type="html">&lt;a href=&quot;http://flymake.sourceforge.net/&quot;&gt;Flymake&lt;/a&gt; is an on-the-fly syntax checker for Emacs.  Here is how you can use it for editing the PostgreSQL source code.  Add this to your &lt;tt&gt;src/Makefile.custom&lt;/tt&gt;:&lt;br /&gt;&lt;pre&gt;check-syntax:&lt;br /&gt;        $(COMPILE.c) -fsyntax-only $(CHK_SOURCES)&lt;/pre&gt;Then you can activate the flymake minor mode either manually using &lt;kbd&gt;M-x flymake-mode&lt;/kbd&gt;, or by adding it to your Emacs customization for PostgreSQL.  I use:&lt;br /&gt;&lt;pre&gt;(defun pgsql-c-mode ()&lt;br /&gt;  &quot;C mode adjusted for PostgreSQL project&quot;&lt;br /&gt;  (interactive)&lt;br /&gt;  (c-mode)&lt;br /&gt;  (flymake-mode)&lt;br /&gt;&lt;br /&gt;  ; .. and the rest ...&lt;br /&gt;)&lt;/pre&gt;Here is a screenshot:&lt;br /&gt;&lt;div class=&quot;separator&quot;&gt;&lt;a href=&quot;http://1.bp.blogspot.com/_dgdplFJMdoQ/TFCHQHxmUWI/AAAAAAAAADg/WMmVpBJYC9o/s1600/flymake-postgresql1.png&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;321&quot; src=&quot;http://1.bp.blogspot.com/_dgdplFJMdoQ/TFCHQHxmUWI/AAAAAAAAADg/WMmVpBJYC9o/s400/flymake-postgresql1.png&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;Notice the marked line with the syntax error and the tooltip/popup with the error message, which appears when the mouse hovers over the marked line.&lt;br /&gt;&lt;br /&gt;Note, however, that since activating flymake will essentially cause a compiler to be running continuously in the background, this is not what you want to use when hacking PostgreSQL on the road. ;-)&lt;div class=&quot;blogger-post-footer&quot;&gt;&lt;img width=&quot;1&quot; height=&quot;1&quot; src=&quot;https://blogger.googleusercontent.com/tracker/5541296000399974369-7254060052395031757?l=petereisentraut.blogspot.com&quot; alt=&quot;&quot; /&gt;&lt;/div&gt;</content>
		<author>
			<name>Peter Eisentraut</name>
			<email>peter@eisentraut.org</email>
			<uri>http://petereisentraut.blogspot.com/search/label/PostgreSQL</uri>
		</author>
		<source>
			<title type="html">Peter Eisentraut's Blog</title>
			<subtitle type="html">on software development, open source, databases, and geek stuff</subtitle>
			<link rel="self" href="http://petereisentraut.blogspot.com/feeds/posts/default/-/PostgreSQL/"/>
			<id>tag:blogger.com,1999:blog-5541296000399974369</id>
			<updated>2010-08-29T18:15:06+00:00</updated>
		</source>
	</entry>

	<entry>
		<title type="html">PostgreSQL: per-version .psqlrc</title>
		<link href="http://blog.endpoint.com/2010/07/postgresql-per-version-psqlrc.html"/>
		<id>tag:blogger.com,1999:blog-7997313029981170997.post-3371495103932890220</id>
		<updated>2010-07-28T21:31:29+00:00</updated>
		<content type="html">&lt;p&gt;File this under &quot;you learn something new every day.&quot;  I came across this little tidbit while browsing the source code for &lt;tt&gt;psql&lt;/tt&gt;: you can have a per-version &lt;tt&gt;.psqlrc&lt;/tt&gt; file which will be executed only by the psql associated with that major version.  Just name the file &lt;tt&gt;.psqlrc-$version&lt;/tt&gt;, substituting the major version for the &lt;tt&gt;$version&lt;/tt&gt; token.  So for PostgreSQL 8.4.4, it would look for a file named &lt;tt&gt;.psqlrc-8.4.4&lt;/tt&gt; in your &lt;tt&gt;$HOME&lt;/tt&gt; directory.&lt;/p&gt;

&lt;p&gt;It's worth noting that the version-specific &lt;tt&gt;.psqlrc&lt;/tt&gt; file requires the full minor version, so you cannot currently define (say) an 8.4-only version which applies to all 8.4 &lt;tt&gt;psql&lt;/tt&gt;s.  I don't know if this feature gets enough mileage to make said modification worth it, but it would be easy enough to just use a symlink from the &lt;tt&gt;.psqlrc-$majorversion&lt;/tt&gt; to the specific &lt;tt&gt;.psqlrc&lt;/tt&gt; file with minor version.&lt;/p&gt;

&lt;p&gt;This seems of most interest to developers, who may simultaneously run many versions of &lt;tt&gt;psql&lt;/tt&gt; which may have incompatible settings, but also could come in handy to regular users as well.&lt;/p&gt;&lt;div class=&quot;blogger-post-footer&quot;&gt;&lt;img width=&quot;1&quot; height=&quot;1&quot; src=&quot;https://blogger.googleusercontent.com/tracker/7997313029981170997-3371495103932890220?l=blog.endpoint.com&quot; alt=&quot;&quot; /&gt;&lt;/div&gt;</content>
		<author>
			<name>David Christensen</name>
			<email>david@endpoint.com</email>
			<uri>http://blog.endpoint.com/search/label/postgres</uri>
		</author>
		<source>
			<title type="html">End Point Blog</title>
			<subtitle type="html">Ongoing observations by End Point people.</subtitle>
			<link rel="self" href="http://blog.endpoint.com/feeds/posts/default/-/postgres/"/>
			<id>tag:blogger.com,1999:blog-7997313029981170997</id>
			<updated>2010-09-01T18:30:29+00:00</updated>
		</source>
	</entry>

	<entry>
		<title type="html">FOSSExperts, day 2</title>
		<link href="http://www.commandprompt.com/blogs/joshua_drake/2010/07/fossexperts_day_2/"/>
		<id>http://www.commandprompt.com/blogs/joshua_drake/2010/07/fossexperts_day_2/</id>
		<updated>2010-07-28T16:35:05+00:00</updated>
		<content type="html">I expected feedback from the community on &lt;a href=&quot;https://www.fossexperts.com/&quot;&gt;FOSSExperts&lt;/a&gt;. I did not expect feedback with such immediacy. All the feedback I have received so far is positive. Which is a great feeling. Here are the key points that are coming back.&lt;p&gt;&lt;strong&gt;How do deal with disagreement about the deliverable:&lt;/strong&gt;&lt;p&gt;This is an interesting one. I wanted to keep FOSSExperts simple. That is why the deliverable on the &lt;a href=&quot;https://www.fossexperts.com/content/postgresql-alter-table-column-position&quot;&gt;ALTER TABLE&lt;/a&gt; project is simple, committed to PostgreSQL Core. &lt;p&gt;That may not work in all circumstances. So I am considering one of two options. The first option is courtesy of Josh Berkus. The idea would be to have a board of people that determine whether or not the deliverable has been met. This has merit because you have a panel of experts that make the determination. It can make the review process painless but is also takes the power out of both the funders and developers.&lt;p&gt;The second one is to take a vote. It would work something like this.&lt;ul&gt;
&lt;li&gt;Developer states project is complete and demonstrates completeness based on the deliverable.
&lt;li&gt;Every person who funded the project votes on whether or not the project is complete.&lt;p&gt;&lt;ul&gt;&lt;li&gt;If 66% vote the project complete, developer gets their money.
&lt;li&gt;If less than 66% vote project incomplete, developer doesn't get their money.
&lt;/li&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;There would have to be some caveats. First the funders need to be able to communicate with the developer because they may not have understood part of the spec. Further as we are working with Open Source, the end deliverable may have been changed based on the will of the community versus the developer (see the Hot Standby work with PostgreSQL).&lt;p&gt;The voting would also need to be limited to a period of time. I was thinking 14 days. The 66% would be tallied against those that voted in that 14 days.&lt;p&gt;I like this idea because it removes the third party and it stops a single funder from calling foul as they are part of a collective vote. What do you think?
&lt;/p&gt;&lt;/p&gt;&lt;/p&gt;&lt;/p&gt;&lt;/li&gt;&lt;/li&gt;&lt;/ul&gt;
Other than that the feedback has been extremely positive. I even posted to the LedgerSMB list and multiple people are excited to see this opportunity.
&lt;/p&gt;&lt;/p&gt;&lt;/p&gt;&lt;/p&gt;
If you have ideas, &lt;a href=&quot;https://www.fossexperts.com/content/love-and-hate-fossexperts&quot;&gt;please share them. We have setup a flame page just for this.&lt;/a&gt;
&lt;p&gt;Remember a lot of your questions &lt;a href=&quot;https://www.fossexperts.com/faq&quot;&gt;can be answered in the FAQ as well.&lt;/a&gt;&lt;/p&gt;</content>
		<author>
			<name>Joshua D. Drake</name>
			<uri>http://www.commandprompt.com/blogs/joshua_drake/</uri>
		</author>
		<source>
			<title type="html">CMD: Joshua Drake's Blog</title>
			<subtitle type="html">Command Prompt Blog Feed: Joshua Drake's Blog</subtitle>
			<link rel="self" href="http://www.commandprompt.com/rss/blogs/joshua_drake"/>
			<id>http://www.commandprompt.com/rss/blogs/joshua_drake</id>
			<updated>2010-09-02T14:30:26+00:00</updated>
		</source>
	</entry>

</feed>
