<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: PostgreSQL: UPDATE a table using ORDER BY</title>
	<atom:link href="http://www.pelagodesign.com/blog/2007/07/23/postgresql-update-a-table-using-order-by/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.pelagodesign.com/blog/2007/07/23/postgresql-update-a-table-using-order-by/</link>
	<description>Santa Barbara Web Design and Web Development Blog on the web world and other randoms</description>
	<lastBuildDate>Mon, 06 Feb 2012 20:31:19 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1</generator>
	<item>
		<title>By: Developer Blog: Ordered updates with Postgres</title>
		<link>http://www.pelagodesign.com/blog/2007/07/23/postgresql-update-a-table-using-order-by/comment-page-1/#comment-6871</link>
		<dc:creator>Developer Blog: Ordered updates with Postgres</dc:creator>
		<pubDate>Thu, 03 Nov 2011 00:05:34 +0000</pubDate>
		<guid isPermaLink="false">http://www.pelagodesign.com/blog/2007/07/23/postgresql-update-a-table-using-order-by/#comment-6871</guid>
		<description>&lt;!--%kramer-ref-pre%--&gt;[...] in the alphabetical order given by a text string column.   With postgres 8.4 the solution using an updateable, ordered view didn&#039;t work (anymore?). After experimenting a little I found that clustering a table according to [...]&lt;!--%kramer-ref-post%--&gt;</description>
		<content:encoded><![CDATA[<p><a href="http://dev.wp-plugins.org/wiki/Kramer"><img src="http://www.pelagodesign.com/blog/wp-content/plugins/kramer.php?kramer=gif-icon" class="technorati-balloon" alt="Kramer auto Pingback" style="border:0;" /></a>[...] in the alphabetical order given by a text string column.   With postgres 8.4 the solution using an updateable, ordered view didn&#039;t work (anymore?). After experimenting a little I found that clustering a table according to [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Project management and web design &#124; Project management and time tracking blog for web designers and small business :: the Intervals Blog by Pelago</title>
		<link>http://www.pelagodesign.com/blog/2007/07/23/postgresql-update-a-table-using-order-by/comment-page-1/#comment-6814</link>
		<dc:creator>Project management and web design &#124; Project management and time tracking blog for web designers and small business :: the Intervals Blog by Pelago</dc:creator>
		<pubDate>Wed, 28 Sep 2011 10:40:39 +0000</pubDate>
		<guid isPermaLink="false">http://www.pelagodesign.com/blog/2007/07/23/postgresql-update-a-table-using-order-by/#comment-6814</guid>
		<description>&lt;!--%kramer-ref-pre%--&gt;[...] Pelago Blog :: web development links and random tidbits from the creative minds of Team Pelago Says:  December 5th, 2008 at 9:55 am [...]&lt;!--%kramer-ref-post%--&gt;</description>
		<content:encoded><![CDATA[<p><a href="http://dev.wp-plugins.org/wiki/Kramer"><img src="http://www.pelagodesign.com/blog/wp-content/plugins/kramer.php?kramer=gif-icon" class="technorati-balloon" alt="Kramer auto Pingback" style="border:0;" /></a>[...] Pelago Blog :: web development links and random tidbits from the creative minds of Team Pelago Says:  December 5th, 2008 at 9:55 am [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mike T</title>
		<link>http://www.pelagodesign.com/blog/2007/07/23/postgresql-update-a-table-using-order-by/comment-page-1/#comment-6575</link>
		<dc:creator>Mike T</dc:creator>
		<pubDate>Wed, 06 Oct 2010 21:43:31 +0000</pubDate>
		<guid isPermaLink="false">http://www.pelagodesign.com/blog/2007/07/23/postgresql-update-a-table-using-order-by/#comment-6575</guid>
		<description>Another good strategy is to use a self-sub-select, as described http://postgresql.1045698.n5.nabble.com/UPDATE-FROM-will-ORDER-BY-not-respected-td1917581.html

Sorta like:

 UPDATE impt_table 
 SET id = newid 
 FROM 
     	   ( 
     	   SELECT foo.seq, 
           nextval(&#039;&#039;id_seq&#039;&#039;) AS newid 
           (SELECT seq 
           FROM impt_table 
           WHERE id IS NULL 
           ORDER BY seq 
           ) AS foo 
           ) ASempty_ids 
 WHERE 
           impt_table.seq = empty_ids.seq 
           AND impt_table.id IS NULL;</description>
		<content:encoded><![CDATA[<p>Another good strategy is to use a self-sub-select, as described <a href="http://postgresql.1045698.n5.nabble.com/UPDATE-FROM-will-ORDER-BY-not-respected-td1917581.html" rel="nofollow">http://postgresql.1045698.n5.nabble.com/UPDATE-FROM-will-ORDER-BY-not-respected-td1917581.html</a></p>
<p>Sorta like:</p>
<p> UPDATE impt_table<br />
 SET id = newid<br />
 FROM<br />
     	   (<br />
     	   SELECT foo.seq,<br />
           nextval(&#8221;id_seq&#8221;) AS newid<br />
           (SELECT seq<br />
           FROM impt_table<br />
           WHERE id IS NULL<br />
           ORDER BY seq<br />
           ) AS foo<br />
           ) ASempty_ids<br />
 WHERE<br />
           impt_table.seq = empty_ids.seq<br />
           AND impt_table.id IS NULL;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dexel</title>
		<link>http://www.pelagodesign.com/blog/2007/07/23/postgresql-update-a-table-using-order-by/comment-page-1/#comment-6543</link>
		<dc:creator>Dexel</dc:creator>
		<pubDate>Wed, 31 Mar 2010 22:00:21 +0000</pubDate>
		<guid isPermaLink="false">http://www.pelagodesign.com/blog/2007/07/23/postgresql-update-a-table-using-order-by/#comment-6543</guid>
		<description>order by ignore!</description>
		<content:encoded><![CDATA[<p>order by ignore!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: jasper</title>
		<link>http://www.pelagodesign.com/blog/2007/07/23/postgresql-update-a-table-using-order-by/comment-page-1/#comment-6504</link>
		<dc:creator>jasper</dc:creator>
		<pubDate>Fri, 19 Feb 2010 11:34:01 +0000</pubDate>
		<guid isPermaLink="false">http://www.pelagodesign.com/blog/2007/07/23/postgresql-update-a-table-using-order-by/#comment-6504</guid>
		<description>Hi,

I tried this solution over and over again, i just cant get it to work. If I do a SELECT query on my newly created view, it shows all the data ordered like it supposed to be. But when executing an update against the view (with the rule in place) it just seems to ignore the order in the view. So i end up with exactly the same result as i would have executing an update query against the normal table?
I am using postgres 8.4.2, not sure if that changes anything.

Any help would be appreciated!</description>
		<content:encoded><![CDATA[<p>Hi,</p>
<p>I tried this solution over and over again, i just cant get it to work. If I do a SELECT query on my newly created view, it shows all the data ordered like it supposed to be. But when executing an update against the view (with the rule in place) it just seems to ignore the order in the view. So i end up with exactly the same result as i would have executing an update query against the normal table?<br />
I am using postgres 8.4.2, not sure if that changes anything.</p>
<p>Any help would be appreciated!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Christian</title>
		<link>http://www.pelagodesign.com/blog/2007/07/23/postgresql-update-a-table-using-order-by/comment-page-1/#comment-6213</link>
		<dc:creator>Christian</dc:creator>
		<pubDate>Wed, 24 Sep 2008 22:37:46 +0000</pubDate>
		<guid isPermaLink="false">http://www.pelagodesign.com/blog/2007/07/23/postgresql-update-a-table-using-order-by/#comment-6213</guid>
		<description>You saved my day!
Thank you for this useful information.</description>
		<content:encoded><![CDATA[<p>You saved my day!<br />
Thank you for this useful information.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

