<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>select * from depesz; &#187; sql</title>
	<atom:link href="http://www.depesz.com/tag/sql/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.depesz.com</link>
	<description></description>
	<lastBuildDate>Tue, 07 Feb 2012 13:35:12 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Grouping data into time ranges</title>
		<link>http://www.depesz.com/2010/10/22/grouping-data-into-time-ranges/</link>
		<comments>http://www.depesz.com/2010/10/22/grouping-data-into-time-ranges/#comments</comments>
		<pubDate>Fri, 22 Oct 2010 12:27:13 +0000</pubDate>
		<dc:creator>depesz</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[date]]></category>
		<category><![CDATA[function]]></category>
		<category><![CDATA[functions]]></category>
		<category><![CDATA[group by]]></category>
		<category><![CDATA[groups]]></category>
		<category><![CDATA[postgresql]]></category>
		<category><![CDATA[range]]></category>
		<category><![CDATA[sql]]></category>
		<category><![CDATA[time]]></category>
		<category><![CDATA[timestamp]]></category>

		<guid isPermaLink="false">http://www.depesz.com/?p=1882</guid>
		<description><![CDATA[Today some guy on IRC asked question, which I didn&#8217;t fully understand, but which could (probably) be summarized: how to group data into 5 minute intervals, based on some timestamp column. Well, it seems trivial (as long as you know how to do it), but since he clearly didn&#8217;t know how to do it (or [...]]]></description>
		<wfw:commentRss>http://www.depesz.com/2010/10/22/grouping-data-into-time-ranges/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Waiting for 9.1 &#8211; CREATE TABLE IF NOT EXISTS</title>
		<link>http://www.depesz.com/2010/07/28/waiting-for-9-1-create-table-if-not-exists/</link>
		<comments>http://www.depesz.com/2010/07/28/waiting-for-9-1-create-table-if-not-exists/#comments</comments>
		<pubDate>Wed, 28 Jul 2010 12:06:23 +0000</pubDate>
		<dc:creator>depesz</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[conditional]]></category>
		<category><![CDATA[create table]]></category>
		<category><![CDATA[ddl]]></category>
		<category><![CDATA[if not exists]]></category>
		<category><![CDATA[pg91]]></category>
		<category><![CDATA[postgresql]]></category>
		<category><![CDATA[sql]]></category>

		<guid isPermaLink="false">http://www.depesz.com/?p=1777</guid>
		<description><![CDATA[On 25th Robert Haas committed patch which adds first of &#8216;CREATE IF NOT EXISTS&#8217; commands: Log Message: ----------- CREATE TABLE IF NOT EXISTS. &#160; Reviewed by Bernd Helmle. Example is of course trivial: $ create table if not exists tesit (x text); CREATE TABLE &#160; $ create table if not exists tesit (x text); NOTICE: [...]]]></description>
		<wfw:commentRss>http://www.depesz.com/2010/07/28/waiting-for-9-1-create-table-if-not-exists/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Waiting for 8.5 &#8211; DO</title>
		<link>http://www.depesz.com/2009/11/01/waiting-for-8-5-do/</link>
		<comments>http://www.depesz.com/2009/11/01/waiting-for-8-5-do/#comments</comments>
		<pubDate>Sun, 01 Nov 2009 16:09:24 +0000</pubDate>
		<dc:creator>depesz</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[do]]></category>
		<category><![CDATA[pg85]]></category>
		<category><![CDATA[pg90]]></category>
		<category><![CDATA[plpgsql]]></category>
		<category><![CDATA[postgresql]]></category>
		<category><![CDATA[sql]]></category>

		<guid isPermaLink="false">http://www.depesz.com/?p=1535</guid>
		<description><![CDATA[On 22nd of September, Tom Lane committed a patch by Petr Jelinek: Log Message: ----------- Implement the DO statement to support execution of PL code without having to create a function for it. &#160; Procedural languages now have an additional entry point, namely a function to execute an inline code block. This seemed a better [...]]]></description>
		<wfw:commentRss>http://www.depesz.com/2009/11/01/waiting-for-8-5-do/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Getting session variables without touching postgresql.conf</title>
		<link>http://www.depesz.com/2009/08/20/getting-session-variables-without-touching-postgresql-conf/</link>
		<comments>http://www.depesz.com/2009/08/20/getting-session-variables-without-touching-postgresql-conf/#comments</comments>
		<pubDate>Thu, 20 Aug 2009 18:41:26 +0000</pubDate>
		<dc:creator>depesz</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[configuration]]></category>
		<category><![CDATA[plpgsql]]></category>
		<category><![CDATA[postgresql]]></category>
		<category><![CDATA[sessions]]></category>
		<category><![CDATA[sql]]></category>
		<category><![CDATA[stackoverflow]]></category>
		<category><![CDATA[variables]]></category>

		<guid isPermaLink="false">http://www.depesz.com/?p=1480</guid>
		<description><![CDATA[This post has been updated with new code that uses temporary table &#8211; the code is at the end of post! There was this question on Stack Overflow. For future reference: guy asked how to do session variables &#8211; i.e. something he could define once in session, and later reuse in standard sql queries &#8211; [...]]]></description>
		<wfw:commentRss>http://www.depesz.com/2009/08/20/getting-session-variables-without-touching-postgresql-conf/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Waiting for 8.5 &#8211; pgsql: DROP IF EXISTS for columns and constraints.</title>
		<link>http://www.depesz.com/2009/07/22/waiting-for-8-5-pgsql-drop-if-exists-for-columns-and-constraints/</link>
		<comments>http://www.depesz.com/2009/07/22/waiting-for-8-5-pgsql-drop-if-exists-for-columns-and-constraints/#comments</comments>
		<pubDate>Wed, 22 Jul 2009 09:41:33 +0000</pubDate>
		<dc:creator>depesz</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[column]]></category>
		<category><![CDATA[conditional]]></category>
		<category><![CDATA[constraint]]></category>
		<category><![CDATA[ddl]]></category>
		<category><![CDATA[drop]]></category>
		<category><![CDATA[pg85]]></category>
		<category><![CDATA[pg90]]></category>
		<category><![CDATA[postgresql]]></category>
		<category><![CDATA[sql]]></category>

		<guid isPermaLink="false">http://www.depesz.com/?p=1467</guid>
		<description><![CDATA[On 205h of July Andrew Dunstan committed patch by Andres Freund : Log Message: ----------- DROP IF EXISTS for columns and constraints. Andres Freund. The functionality is self-explanatory, so let&#8217;s just show some usage examples: Test table: # create table test (a int4, b int4); CREATE TABLE Drop non-existing column old way: # alter table [...]]]></description>
		<wfw:commentRss>http://www.depesz.com/2009/07/22/waiting-for-8-5-pgsql-drop-if-exists-for-columns-and-constraints/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Calculating median</title>
		<link>http://www.depesz.com/2009/07/13/calculating-median/</link>
		<comments>http://www.depesz.com/2009/07/13/calculating-median/#comments</comments>
		<pubDate>Mon, 13 Jul 2009 14:13:36 +0000</pubDate>
		<dc:creator>depesz</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[aggregate]]></category>
		<category><![CDATA[dim]]></category>
		<category><![CDATA[irc]]></category>
		<category><![CDATA[plpgsql]]></category>
		<category><![CDATA[postgresql]]></category>
		<category><![CDATA[rhodiumtoad]]></category>
		<category><![CDATA[sql]]></category>

		<guid isPermaLink="false">http://www.depesz.com/?p=1463</guid>
		<description><![CDATA[Today, on irc (#postgresql on freenode.net) Dim mentioned about writing median calculation code. It got me thinking, and consequently writing my version of median calculation code. Before I will go any further, let me just say &#8211; after I finished, and was quite happy with what I wrote, RhodiumToad showed his approach which is (of [...]]]></description>
		<wfw:commentRss>http://www.depesz.com/2009/07/13/calculating-median/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Tips N’ Tricks &#8211; Generating readable reports with plain SQL</title>
		<link>http://www.depesz.com/2009/06/23/tips-n%e2%80%99-tricks-generating-readable-reports-with-plain-sql/</link>
		<comments>http://www.depesz.com/2009/06/23/tips-n%e2%80%99-tricks-generating-readable-reports-with-plain-sql/#comments</comments>
		<pubDate>Tue, 23 Jun 2009 11:51:43 +0000</pubDate>
		<dc:creator>depesz</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[postgresql]]></category>
		<category><![CDATA[psql]]></category>
		<category><![CDATA[report]]></category>
		<category><![CDATA[sql]]></category>
		<category><![CDATA[tnt]]></category>

		<guid isPermaLink="false">http://www.depesz.com/?p=1434</guid>
		<description><![CDATA[Let&#8217;s say you imported some data, but it contains duplicates. You will have to handle them in some way, but to make sensible choice on how to handle it, you need more information. So, let&#8217;s start. We have table: # \d users Table "public.users" Column &#124; Type &#124; Modifiers ------------+--------------------------+---------------------------------------------------- id &#124; integer &#124; not [...]]]></description>
		<wfw:commentRss>http://www.depesz.com/2009/06/23/tips-n%e2%80%99-tricks-generating-readable-reports-with-plain-sql/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Set operations in shell</title>
		<link>http://www.depesz.com/2009/03/12/set-operations-in-shell/</link>
		<comments>http://www.depesz.com/2009/03/12/set-operations-in-shell/#comments</comments>
		<pubDate>Thu, 12 Mar 2009 21:40:50 +0000</pubDate>
		<dc:creator>depesz</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[set]]></category>
		<category><![CDATA[sets]]></category>
		<category><![CDATA[shell]]></category>
		<category><![CDATA[sort]]></category>
		<category><![CDATA[sql]]></category>
		<category><![CDATA[uniq]]></category>

		<guid isPermaLink="false">http://www.depesz.com/?p=1389</guid>
		<description><![CDATA[I had this interesting case at work. We have imports of objects. Each object in import file has its &#8220;ID&#8221; (which can be any string). Same &#8220;ID&#8221; is in database. So the idea is pretty simple &#8211; we can/should check how many of IDs from import were in database. Unfortunately &#8211; we&#8217;d rather not really [...]]]></description>
		<wfw:commentRss>http://www.depesz.com/2009/03/12/set-operations-in-shell/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Maintainable queries &#8211; my point of view</title>
		<link>http://www.depesz.com/2009/01/04/maintainable-queries-my-point-of-view/</link>
		<comments>http://www.depesz.com/2009/01/04/maintainable-queries-my-point-of-view/#comments</comments>
		<pubDate>Sun, 04 Jan 2009 21:34:06 +0000</pubDate>
		<dc:creator>depesz</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[indent]]></category>
		<category><![CDATA[postgresql]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[reply]]></category>
		<category><![CDATA[sql]]></category>
		<category><![CDATA[style]]></category>

		<guid isPermaLink="false">http://www.depesz.com/?p=1361</guid>
		<description><![CDATA[This post is basically just an reply to Josh Berkus blog post. Additionally, it refers to &#8220;SQL Coding Standards To Each His Own&#8221; by Leo Hsu and Regina Obe. Well, I&#8217;ve read what Josh wrote, and I though to myself &#8211; oh my, I must be doing something wrong, as I would never use long [...]]]></description>
		<wfw:commentRss>http://www.depesz.com/2009/01/04/maintainable-queries-my-point-of-view/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Getting list of most common domains</title>
		<link>http://www.depesz.com/2008/12/01/getting-list-of-most-common-domains/</link>
		<comments>http://www.depesz.com/2008/12/01/getting-list-of-most-common-domains/#comments</comments>
		<pubDate>Sun, 30 Nov 2008 22:03:02 +0000</pubDate>
		<dc:creator>depesz</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[domain]]></category>
		<category><![CDATA[functions]]></category>
		<category><![CDATA[irc]]></category>
		<category><![CDATA[plpgsql]]></category>
		<category><![CDATA[postgresql]]></category>
		<category><![CDATA[report]]></category>
		<category><![CDATA[sql]]></category>

		<guid isPermaLink="false">http://www.depesz.com/?p=1330</guid>
		<description><![CDATA[Today, on #postgresql on IRC, guy (can&#8217;t contact him now to get his permission to name him), said: I have a table called problematic_hostnames. It contains a list of banned hostnames in column &#8220;hostname&#8221; (varchar). I would like to display the top 10 troll ISPs based on this. Does PG have a way of spotting [...]]]></description>
		<wfw:commentRss>http://www.depesz.com/2008/12/01/getting-list-of-most-common-domains/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Waiting for 8.4 &#8211; sql-wrappable RETURNING</title>
		<link>http://www.depesz.com/2008/11/03/waiting-for-84-sql-wrappable-returning/</link>
		<comments>http://www.depesz.com/2008/11/03/waiting-for-84-sql-wrappable-returning/#comments</comments>
		<pubDate>Mon, 03 Nov 2008 12:37:16 +0000</pubDate>
		<dc:creator>depesz</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[functions]]></category>
		<category><![CDATA[pg84]]></category>
		<category><![CDATA[postgresql]]></category>
		<category><![CDATA[returning]]></category>
		<category><![CDATA[sql]]></category>

		<guid isPermaLink="false">http://www.depesz.com/?p=1307</guid>
		<description><![CDATA[In PostgreSQL 8.2, we got &#8220;RETURNING&#8221; clause in INSERT/UPDATE/DELETE queries. Unfortunately it could not be used as source of rows for anything in sql. insert into table_backup delete from table where ... returning *; Well, it&#8217;s still not possible, but it is a one step closer, thanks to patch written and committed by Tom Lane [...]]]></description>
		<wfw:commentRss>http://www.depesz.com/2008/11/03/waiting-for-84-sql-wrappable-returning/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Text comparisons that does automatic trim()</title>
		<link>http://www.depesz.com/2008/10/15/text-comparisons-that-does-automatic-trim/</link>
		<comments>http://www.depesz.com/2008/10/15/text-comparisons-that-does-automatic-trim/#comments</comments>
		<pubDate>Wed, 15 Oct 2008 20:04:20 +0000</pubDate>
		<dc:creator>depesz</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[datatype]]></category>
		<category><![CDATA[domain]]></category>
		<category><![CDATA[postgresql]]></category>
		<category><![CDATA[sql]]></category>
		<category><![CDATA[trim]]></category>

		<guid isPermaLink="false">http://www.depesz.com/?p=1296</guid>
		<description><![CDATA[SoftNum asked on irc: &#60; SoftNum&#62; does postgresql have a config option to automatically trim (both ' ' from blah) on string compares? So, can you? Of course there is no such option, but maybe there is a way to tell PostgreSQL to do this trim for given field? Sure there is To do it, [...]]]></description>
		<wfw:commentRss>http://www.depesz.com/2008/10/15/text-comparisons-that-does-automatic-trim/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Removing elements from arrays</title>
		<link>http://www.depesz.com/2008/08/06/removing-elements-from-arrays/</link>
		<comments>http://www.depesz.com/2008/08/06/removing-elements-from-arrays/#comments</comments>
		<pubDate>Wed, 06 Aug 2008 18:02:42 +0000</pubDate>
		<dc:creator>depesz</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[arrays]]></category>
		<category><![CDATA[intarray]]></category>
		<category><![CDATA[plpgsql]]></category>
		<category><![CDATA[postgresql]]></category>
		<category><![CDATA[sql]]></category>

		<guid isPermaLink="false">http://www.depesz.com/?p=1233</guid>
		<description><![CDATA[Cezio wrote post about removing elements from arrays in PostgreSQL. Unfortunately his blog engine requires registration before comment, which I don&#8217;t like, so I decided to comment using my own blogspace. The approach Cezio showed is pretty cool &#8211; having more functions to handle arrays is definitely cool, but it might be better to use [...]]]></description>
		<wfw:commentRss>http://www.depesz.com/2008/08/06/removing-elements-from-arrays/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Conditional DDL?</title>
		<link>http://www.depesz.com/2008/06/18/conditional-ddl/</link>
		<comments>http://www.depesz.com/2008/06/18/conditional-ddl/#comments</comments>
		<pubDate>Wed, 18 Jun 2008 12:53:23 +0000</pubDate>
		<dc:creator>depesz</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[conditions]]></category>
		<category><![CDATA[ddl]]></category>
		<category><![CDATA[functions]]></category>
		<category><![CDATA[plpgsql]]></category>
		<category><![CDATA[postgresql]]></category>
		<category><![CDATA[sql]]></category>

		<guid isPermaLink="false">http://www.depesz.com/?p=1217</guid>
		<description><![CDATA[Every now and then I see people ask the question &#8211; how to create table if it doesn&#8217;t exist yet, how to drop it, but only if it does exist and so on. Well, starting from 8.2 dropping should be not a problem anymore. But what about create? Alter? Let&#8217;s try to do it&#8230; First [...]]]></description>
		<wfw:commentRss>http://www.depesz.com/2008/06/18/conditional-ddl/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>waiting for 8.4</title>
		<link>http://www.depesz.com/2008/03/28/waiting-for-84/</link>
		<comments>http://www.depesz.com/2008/03/28/waiting-for-84/#comments</comments>
		<pubDate>Fri, 28 Mar 2008 20:56:43 +0000</pubDate>
		<dc:creator>depesz</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[databases]]></category>
		<category><![CDATA[pg84]]></category>
		<category><![CDATA[plpgsql]]></category>
		<category><![CDATA[postgresql]]></category>
		<category><![CDATA[sql]]></category>
		<category><![CDATA[triggers]]></category>
		<category><![CDATA[truncate]]></category>

		<guid isPermaLink="false">http://www.depesz.com/index.php/2008/03/28/waiting-for-84/</guid>
		<description><![CDATA[another new, cool feature commited by tom lane: &#8220;Support statement-level ON TRUNCATE triggers.&#8221; original patch was submitted by simon riggs, and tom commited it today/yesterday (depending on time zone). commit log can be found in pgsql-committers archives. patch is quite large, it modified 23 files. functionality seems to be pretty obvious: you can create triggers [...]]]></description>
		<wfw:commentRss>http://www.depesz.com/2008/03/28/waiting-for-84/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>

