Skip Menu |

This queue is for tickets about the SQL-Statement CPAN distribution.

Report information
The Basics
Id: 15690
Status: resolved
Priority: 0/
Queue: SQL-Statement

People
Owner: JZUCKER [...] cpan.org
Requestors: bwarfield [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 1.14
Fixed in: (no value)



Subject: Outer natural joins not actually outer
According to my possibly flawed understanding, the statement SELECT * FROM Prof OUTER NATURAL JOIN Subject should produce a record for every row of Prof, even if there is no matching naturally-joined row in Subject. Accordingly, the attached patch adds a test for that condition to t/08join.t (which, alas, fails).
--- t/08join.t Thu Nov 10 17:47:29 2005 +++ ../SQL-Statement-1.15/t//08join.t Thu Nov 10 17:42:43 2005 @@ -8,7 +8,7 @@ plan skip_all => "No DBD::File available"; } else { - plan tests => 14; + plan tests => 15; } use SQL::Statement; printf "SQL::Statement v.%s\n", $SQL::Statement::VERSION; use vars qw($dbh $sth $DEBUG); @@ -49,6 +49,11 @@ queryresult_is("SELECT * FROM Prof LEFT JOIN Subject USING(pid)", '1~Sue~Chem^2~Bob~Bio^2~Bob~Math^3~Tom~undef^', 'LEFT JOIN' +); + +queryresult_is("SELECT * FROM Prof OUTER NATURAL JOIN Subject", + '1~Sue~Chem^2~Bob~Bio^2~Bob~Math^3~Tom~undef^', + 'OUTER NATURAL JOIN' ); queryresult_is("SELECT pid,pname,sname FROM Prof LEFT JOIN Subject USING(pid)",
Note that the patch is against the version of 08join.t produced by my previous patch ([cpan #15686]), because I'm an optimist that way. :-)
From: Benjamin Warfield <BWARFIELD [...] cpan.org>
Subject: Re: [cpan #15690] AutoReply: Outer natural joins not actually outer
Date: Sat, 12 Nov 2005 00:53:19 -0500
To: bug-SQL-Statement [...] rt.cpan.org
RT-Send-Cc:
A little more investigation shows that this is not actually a bug, it's an SQL error (it parses 'OUTER' as an alias for Prof, and does a natural inner join, as it should). The desired behavior can be obtained with "NATURAL LEFT JOIN", or indeed "NATURAL LEFT OUTER JOIN", but apparently not "NATURAL OUTER JOIN", which was the other thing I tried before. My apologies for the incorrect bug report.
Ok, it looks like this one was a misunderstanding, filing it away.