<?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 for Experimental Thoughts</title>
	<atom:link href="http://thoughts.j-davis.com/comments/feed/" rel="self" type="application/rss+xml" />
	<link>http://thoughts.j-davis.com</link>
	<description>Ideas on Databases, Logic, and Language by Jeff Davis</description>
	<lastBuildDate>Tue, 18 Oct 2011 07:43:52 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
	<item>
		<title>Comment on SQL: the successful cousin of Haskell by Jeff Davis</title>
		<link>http://thoughts.j-davis.com/2011/09/25/sql-the-successful-cousin-of-haskell/comment-page-1/#comment-2398</link>
		<dc:creator>Jeff Davis</dc:creator>
		<pubDate>Tue, 18 Oct 2011 07:43:52 +0000</pubDate>
		<guid isPermaLink="false">http://thoughts.j-davis.com/?p=472#comment-2398</guid>
		<description>The example you used is invalid per SQL spec, and if you&#039;d like to see a better type system try PostgreSQL. MySQL is notoriously loose with types. I don&#039;t disagree with your point though -- there are some important weaknesses in SQL&#039;s type system compared with that of haskell.

I believe that type strictness in SQL brings more confidence to the answers given by the system. What you don&#039;t want is for your data to bring about unexpected edge cases, and the type constraints help a great deal with that (e.g. if the column is of type &quot;integer&quot;, you know you&#039;re not going to get &quot;9foobar&quot;).

Unfortunately, NULL semantics really destroy this property of SQL because they introduce exactly the kind of edge cases that cause errors, and they propagate through the query making subtle errors more likely. For instance, consider the query: &lt;code&gt;SELECT dealer, sum(sales) FROM dealer_sales GROUP BY dealer HAVING sum(sales) &lt; 100000;&lt;/code&gt;. What that query should do is return under-performing dealers (those with low sales). But if a certain dealer no sales at all, the sum() returns NULL, and thus the dealer is not returned (because any comparison with NULL is NULL). However, the answer will look right -- it&#039;s just missing some of the dealers. That kind of subtle problem is something that haskell could easily catch through exhaustive pattern matching over a Maybe.

[ I think that this thread has been closed for comments (which I have to do to avoid too much spam), but I&#039;ll see if I can figure out how to re-open it. ]</description>
		<content:encoded><![CDATA[<p>The example you used is invalid per SQL spec, and if you&#8217;d like to see a better type system try PostgreSQL. MySQL is notoriously loose with types. I don&#8217;t disagree with your point though &#8212; there are some important weaknesses in SQL&#8217;s type system compared with that of haskell.</p>
<p>I believe that type strictness in SQL brings more confidence to the answers given by the system. What you don&#8217;t want is for your data to bring about unexpected edge cases, and the type constraints help a great deal with that (e.g. if the column is of type &#8220;integer&#8221;, you know you&#8217;re not going to get &#8220;9foobar&#8221;).</p>
<p>Unfortunately, NULL semantics really destroy this property of SQL because they introduce exactly the kind of edge cases that cause errors, and they propagate through the query making subtle errors more likely. For instance, consider the query: <code>SELECT dealer, sum(sales) FROM dealer_sales GROUP BY dealer HAVING sum(sales) &lt; 100000;</code>. What that query should do is return under-performing dealers (those with low sales). But if a certain dealer no sales at all, the sum() returns NULL, and thus the dealer is not returned (because any comparison with NULL is NULL). However, the answer will look right &#8212; it&#8217;s just missing some of the dealers. That kind of subtle problem is something that haskell could easily catch through exhaustive pattern matching over a Maybe.</p>
<p>[ I think that this thread has been closed for comments (which I have to do to avoid too much spam), but I'll see if I can figure out how to re-open it. ]</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on SQL: the successful cousin of Haskell by Greg Benison</title>
		<link>http://thoughts.j-davis.com/2011/09/25/sql-the-successful-cousin-of-haskell/comment-page-1/#comment-2396</link>
		<dc:creator>Greg Benison</dc:creator>
		<pubDate>Sat, 15 Oct 2011 16:30:33 +0000</pubDate>
		<guid isPermaLink="false">http://thoughts.j-davis.com/?p=472#comment-2396</guid>
		<description>Yes, ideas from languages &quot;for theorists only&quot; do have a way of showing up in mainstream contexts, although the source is often not recognized.  Here is another example, from the book &quot;Real World Haskell&quot;:  &quot;Haskell&#039;s parametric polymorphism directly influenced the design of the generic facilities of the Java and C# languages.&quot;

Thanks for pointing out the interesting analogies between SQL and Haskell.  I&#039;d disagree, though (see example below), that SQL is as strict as Haskell is about types - few things are.  What would true type strictness in SQL expressions do to (for?) the language?

mysql&gt; select (&quot;9foobar&quot; = 9);
+------------------+
&#124; (&quot;9foobar&quot; = 9) &#124;
+------------------+
&#124;                     1 &#124;
+------------------+
1 row in set (0.00 sec)</description>
		<content:encoded><![CDATA[<p>Yes, ideas from languages &#8220;for theorists only&#8221; do have a way of showing up in mainstream contexts, although the source is often not recognized.  Here is another example, from the book &#8220;Real World Haskell&#8221;:  &#8220;Haskell&#8217;s parametric polymorphism directly influenced the design of the generic facilities of the Java and C# languages.&#8221;</p>
<p>Thanks for pointing out the interesting analogies between SQL and Haskell.  I&#8217;d disagree, though (see example below), that SQL is as strict as Haskell is about types &#8211; few things are.  What would true type strictness in SQL expressions do to (for?) the language?</p>
<p>mysql&gt; select (&#8220;9foobar&#8221; = 9);<br />
+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;+<br />
| (&#8220;9foobar&#8221; = 9) |<br />
+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;+<br />
|                     1 |<br />
+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;+<br />
1 row in set (0.00 sec)</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on SQL: the successful cousin of Haskell by Jeff Davis</title>
		<link>http://thoughts.j-davis.com/2011/09/25/sql-the-successful-cousin-of-haskell/comment-page-1/#comment-2376</link>
		<dc:creator>Jeff Davis</dc:creator>
		<pubDate>Tue, 27 Sep 2011 16:56:38 +0000</pubDate>
		<guid isPermaLink="false">http://thoughts.j-davis.com/?p=472#comment-2376</guid>
		<description>Yes, I&#039;d certainly like to see more alternatives in this area. A DBMS is seen as a monolith, but in reality there are a few fairly independent pieces that could be offered individually, and I think that could lead to a lot of interesting new ideas and development styles.

Giving a talk on this topic at PG WEST this week.</description>
		<content:encoded><![CDATA[<p>Yes, I&#8217;d certainly like to see more alternatives in this area. A DBMS is seen as a monolith, but in reality there are a few fairly independent pieces that could be offered individually, and I think that could lead to a lot of interesting new ideas and development styles.</p>
<p>Giving a talk on this topic at PG WEST this week.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on SQL: the successful cousin of Haskell by Jeff Davis</title>
		<link>http://thoughts.j-davis.com/2011/09/25/sql-the-successful-cousin-of-haskell/comment-page-1/#comment-2375</link>
		<dc:creator>Jeff Davis</dc:creator>
		<pubDate>Tue, 27 Sep 2011 16:54:09 +0000</pubDate>
		<guid isPermaLink="false">http://thoughts.j-davis.com/?p=472#comment-2375</guid>
		<description>Agreed.</description>
		<content:encoded><![CDATA[<p>Agreed.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Database for a Zoo: the problem and the solution by Jeff Davis</title>
		<link>http://thoughts.j-davis.com/2011/09/21/database-for-a-zoo-the-problem-and-the-solution/comment-page-1/#comment-2374</link>
		<dc:creator>Jeff Davis</dc:creator>
		<pubDate>Tue, 27 Sep 2011 16:50:13 +0000</pubDate>
		<guid isPermaLink="false">http://thoughts.j-davis.com/?p=315#comment-2374</guid>
		<description>Interesting. Did that allow constraints that would work even with concurrent updates?</description>
		<content:encoded><![CDATA[<p>Interesting. Did that allow constraints that would work even with concurrent updates?</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Database for a Zoo: the problem and the solution by Jeff Davis</title>
		<link>http://thoughts.j-davis.com/2011/09/21/database-for-a-zoo-the-problem-and-the-solution/comment-page-1/#comment-2373</link>
		<dc:creator>Jeff Davis</dc:creator>
		<pubDate>Tue, 27 Sep 2011 16:49:27 +0000</pubDate>
		<guid isPermaLink="false">http://thoughts.j-davis.com/?p=315#comment-2373</guid>
		<description>I&#039;m glad you found it useful!

To prevent &quot;gaps&quot; is a little tricky, but perhaps it can be done with triggers, row-level locks, and exclusion constraints. In a way, it&#039;s kind of like a foreign key into the same table. The tricky part is the initial condition for a group where there is no other period to &quot;connect&quot; with.

I&#039;ll think about it a little more and write up a blog post about it.</description>
		<content:encoded><![CDATA[<p>I&#8217;m glad you found it useful!</p>
<p>To prevent &#8220;gaps&#8221; is a little tricky, but perhaps it can be done with triggers, row-level locks, and exclusion constraints. In a way, it&#8217;s kind of like a foreign key into the same table. The tricky part is the initial condition for a group where there is no other period to &#8220;connect&#8221; with.</p>
<p>I&#8217;ll think about it a little more and write up a blog post about it.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on SQL: the successful cousin of Haskell by Darren Duncan</title>
		<link>http://thoughts.j-davis.com/2011/09/25/sql-the-successful-cousin-of-haskell/comment-page-1/#comment-2370</link>
		<dc:creator>Darren Duncan</dc:creator>
		<pubDate>Tue, 27 Sep 2011 00:09:22 +0000</pubDate>
		<guid isPermaLink="false">http://thoughts.j-davis.com/?p=472#comment-2370</guid>
		<description>That&#039;s probably how Muldis D would be the most tightly/efficiently integrated into Postgres, namely at a similar level to how Haskell would.  But before that, probably the first practical implementation will be a Muldis D compiler written in Perl where the compiler converted some code to SQL for running inside the DBMS and some code to Perl for running on the client side.  I liken it to how LLVM compiles targeting partially the GPU and partially the CPU.</description>
		<content:encoded><![CDATA[<p>That&#8217;s probably how Muldis D would be the most tightly/efficiently integrated into Postgres, namely at a similar level to how Haskell would.  But before that, probably the first practical implementation will be a Muldis D compiler written in Perl where the compiler converted some code to SQL for running inside the DBMS and some code to Perl for running on the client side.  I liken it to how LLVM compiles targeting partially the GPU and partially the CPU.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on SQL: the successful cousin of Haskell by Joshua Kugler</title>
		<link>http://thoughts.j-davis.com/2011/09/25/sql-the-successful-cousin-of-haskell/comment-page-1/#comment-2366</link>
		<dc:creator>Joshua Kugler</dc:creator>
		<pubDate>Mon, 26 Sep 2011 17:17:31 +0000</pubDate>
		<guid isPermaLink="false">http://thoughts.j-davis.com/?p=472#comment-2366</guid>
		<description>Well, PL/Haskell does seem to be in development, but has not yet been officially integrated into PostgreSQL yet.</description>
		<content:encoded><![CDATA[<p>Well, PL/Haskell does seem to be in development, but has not yet been officially integrated into PostgreSQL yet.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on SQL: the successful cousin of Haskell by Jeff Davis</title>
		<link>http://thoughts.j-davis.com/2011/09/25/sql-the-successful-cousin-of-haskell/comment-page-1/#comment-2365</link>
		<dc:creator>Jeff Davis</dc:creator>
		<pubDate>Sun, 25 Sep 2011 23:59:11 +0000</pubDate>
		<guid isPermaLink="false">http://thoughts.j-davis.com/?p=472#comment-2365</guid>
		<description>“Yet another place that an API for bypassing the query parser and speaking directly to the planner/executor would be an opportunity to try some new ideas.”

+1</description>
		<content:encoded><![CDATA[<p>“Yet another place that an API for bypassing the query parser and speaking directly to the planner/executor would be an opportunity to try some new ideas.”</p>
<p>+1</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Database for a Zoo: the problem and the solution by Bay Area Guy</title>
		<link>http://thoughts.j-davis.com/2011/09/21/database-for-a-zoo-the-problem-and-the-solution/comment-page-1/#comment-2363</link>
		<dc:creator>Bay Area Guy</dc:creator>
		<pubDate>Sun, 25 Sep 2011 20:24:38 +0000</pubDate>
		<guid isPermaLink="false">http://thoughts.j-davis.com/?p=315#comment-2363</guid>
		<description>Reminds me of REFUSE rules in the original postgres (not postgresql) rule system.</description>
		<content:encoded><![CDATA[<p>Reminds me of REFUSE rules in the original postgres (not postgresql) rule system.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

