<!--
RSS generated by JIRA (5.2.7#850-sha1:b2af0c8dc8537b36121c6a579fabbdf79fc919e5) at Sun May 26 02:13:38 UTC 2013

It is possible to restrict the fields that are returned in this document by specifying the 'field' parameter in your request.
For example, to request only the issue key and summary add field=key&field=summary to the URL of your request.
For example:
http://www.doctrine-project.org/jira/sr/jira.issueviews:searchrequest-xml/temp/SearchRequest.xml?jqlQuery=project+%3D+DC+AND+resolution+%3D+Unresolved+AND+fixVersion+%3D+%221.2.0%22+ORDER+BY+priority+DESC&tempMax=1000&field=key&field=summary
-->
<!-- If you wish to do custom client-side styling of RSS, uncomment this:
<?xml-stylesheet href="http://www.doctrine-project.org/jira/styles/jiraxml2html.xsl" type="text/xsl"?>
-->
<rss version="0.92">
    <channel>
        <title>Doctrine Project</title>
        <link>http://www.doctrine-project.org/jira/secure/IssueNavigator.jspa?reset=true&amp;jqlQuery=project+%3D+DC+AND+resolution+%3D+Unresolved+AND+fixVersion+%3D+%221.2.0%22+ORDER+BY+priority+DESC</link>
        <description>An XML representation of a search request</description>
                <language>en-us</language>
                        <issue start="0" end="2" total="2"/>
                <build-info>
            <version>5.2.7</version>
            <build-number>850</build-number>
            <build-date>21-02-2013</build-date>
        </build-info>
<item>
            <title>[DC-403] Eliminate queries produced by Doctrine_Node_NestedSet::getDescendants() when possible</title>
                <link>http://www.doctrine-project.org/jira/browse/DC-403</link>
                <project id="10031" key="DC">Doctrine 1</project>
                        <description>&lt;h3&gt;&lt;a name=&quot;Howtoreproduce&quot;&gt;&lt;/a&gt;How to reproduce&lt;/h3&gt;

&lt;ol&gt;
	&lt;li&gt;fetch a tree with nested set
&lt;div class=&quot;code panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;codeContent panelContent&quot;&gt;
&lt;pre class=&quot;code-java&quot;&gt;$root = Doctrine::getTable($model)-&amp;gt;getTree()-&amp;gt;findRoot($rootId);
$treeObject= Doctrine::getTable($model)-&amp;gt;getTree()-&amp;gt;fetchTree($root-&amp;gt;getId()); 
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;&lt;/li&gt;
	&lt;li&gt;issue
&lt;div class=&quot;code panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;codeContent panelContent&quot;&gt;
&lt;pre class=&quot;code-java&quot;&gt;$root-&amp;gt;getNode()-&amp;gt;getChildren();

or there will be a total query mess in a lambda function with a loop getChildren().
...
&amp;lt;?php foreach($root-&amp;gt;getChildren() as $child): ?&amp;gt;
   ....
&amp;lt;?php endforeach; ?&amp;gt;
...

&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;&lt;/li&gt;
&lt;/ol&gt;


&lt;p&gt;Problem is described more verbosely here &amp;#8211; &lt;a href=&quot;http://codeutopia.net/blog/2008/08/30/understanding-doctrines-nestedset-feature/&quot; class=&quot;external-link&quot;&gt;http://codeutopia.net/blog/2008/08/30/understanding-doctrines-nestedset-feature/&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;&lt;a name=&quot;Whatbehaviorisexpected&quot;&gt;&lt;/a&gt;What behavior is expected&lt;/h3&gt;
&lt;p&gt;An already fetched record instance is returned, without calling database and without causing query flooding.&lt;/p&gt;

&lt;h3&gt;&lt;a name=&quot;Likeinpropel.&quot;&gt;&lt;/a&gt;Like in propel.&lt;/h3&gt;
&lt;p&gt;In propel if you are calling ....::retrieveTree($id) it returns the root&lt;br/&gt;
with completed, pooled (cached) and linked  tree.&lt;/p&gt;

&lt;h3&gt;&lt;a name=&quot;Whathappens&quot;&gt;&lt;/a&gt;What happens&lt;/h3&gt;
&lt;p&gt;An additional query is issued&lt;/p&gt;

&lt;p&gt;This is a big slip in architecture of Doctrine`s nested set implementation.&lt;/p&gt;</description>
                <environment></environment>
            <key id="10693">DC-403</key>
            <summary>Eliminate queries produced by Doctrine_Node_NestedSet::getDescendants() when possible</summary>
                <type id="4" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/improvement.png">Improvement</type>
                                <priority id="3" iconUrl="http://www.doctrine-project.org/jira/images/icons/priorities/major.png">Major</priority>
                    <status id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/open.png">Open</status>
                    <resolution id="-1">Unresolved</resolution>
                                <assignee username="jwage">Jonathan H. Wage</assignee>
                                <reporter username="zidler">alex</reporter>
                        <labels>
                    </labels>
                <created>Wed, 6 Jan 2010 20:52:18 +0000</created>
                <updated>Fri, 16 Apr 2010 12:18:05 +0000</updated>
                                    <version>1.2.1</version>
                                <fixVersion>1.2.0</fixVersion>
                                <component>Nested Set</component>
                        <due></due>
                    <votes>2</votes>
                        <watches>1</watches>
                                <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>

<item>
            <title>[DC-278] Invalid qubquery generated if using oracle adapter instead of pdo_oci</title>
                <link>http://www.doctrine-project.org/jira/browse/DC-278</link>
                <project id="10031" key="DC">Doctrine 1</project>
                        <description>&lt;p&gt;Doctrine generates the following invalid subquery if oracle adapter is used (same query is generated corret if pdo_oci is used):&lt;/p&gt;

&lt;p&gt;SELECT DISTINCT &quot;s2&quot;.&quot;code&quot; &lt;br/&gt;
FROM &quot;spend_category&quot; &quot;s2&quot; &lt;br/&gt;
INNER JOIN &quot;company_spend_category&quot; &quot;c4&quot; ON (&quot;s2&quot;.&quot;code&quot; = &quot;c4&quot;.&quot;spendcategory_code&quot;) &lt;br/&gt;
INNER JOIN &quot;company&quot; &quot;c3&quot; ON &quot;c3&quot;.&quot;code&quot; = &quot;c4&quot;.&quot;company_code&quot; &lt;br/&gt;
WHERE &quot;s2&quot;.&quot;code&quot; = &apos;19000000&apos; &lt;br/&gt;
AND &quot;c3&quot;.&quot;is_deleted&quot; IS NOT NULL &lt;br/&gt;
AND &quot;s2&quot;.&quot;is_deleted&quot; IS NOT NULL &lt;br/&gt;
ORDER BY &quot;c3&quot;.&quot;name&quot; desc&lt;/p&gt;

&lt;p&gt;The problem is that the order by column is not part of the selected columns.&lt;/p&gt;

&lt;p&gt;Sample dql statement to reproduce this error:&lt;/p&gt;

&lt;p&gt;$this-&amp;gt;pageAllPager = new Doctrine_Pager(&lt;br/&gt;
        $q = Doctrine_Query::create()&lt;br/&gt;
                -&amp;gt;select(&apos;c.code, c.name, c.is_activated, c.is_deleted, sc.code&apos;)&lt;br/&gt;
                -&amp;gt;from(&apos;SpendCategory sc&apos;)&lt;br/&gt;
                -&amp;gt;innerJoin(&apos;sc.Companies c&apos;)&lt;br/&gt;
                -&amp;gt;where(&quot;sc.code = &apos;$spendcategory&apos;&quot;)&lt;br/&gt;
                -&amp;gt;addWhere(&apos;c.is_deleted IS NOT NULL&apos;)&lt;br/&gt;
                -&amp;gt;addWhere(&apos;sc.is_deleted IS NOT NULL&apos;)&lt;br/&gt;
                -&amp;gt;orderBy($orderBy)&lt;br/&gt;
                -&amp;gt;setHydrationMode(Doctrine::HYDRATE_ARRAY),&lt;br/&gt;
                $page,&lt;br/&gt;
                $resultsPerPage);&lt;br/&gt;
}&lt;/p&gt;</description>
                <environment>Linux, Oracle 10g</environment>
            <key id="10491">DC-278</key>
            <summary>Invalid qubquery generated if using oracle adapter instead of pdo_oci</summary>
                <type id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/bug.png">Bug</type>
                                <priority id="3" iconUrl="http://www.doctrine-project.org/jira/images/icons/priorities/major.png">Major</priority>
                    <status id="4" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/reopened.png">Reopened</status>
                    <resolution id="-1">Unresolved</resolution>
                                <assignee username="jwage">Jonathan H. Wage</assignee>
                                <reporter username="tom808">Thomas Wahle</reporter>
                        <labels>
                    </labels>
                <created>Mon, 23 Nov 2009 18:03:28 +0000</created>
                <updated>Wed, 9 Jun 2010 13:02:31 +0000</updated>
                                                    <fixVersion>1.2.0</fixVersion>
                                        <due></due>
                    <votes>0</votes>
                        <watches>0</watches>
                        <comments>
                    <comment id="10827" author="jwage" created="Mon, 23 Nov 2009 23:37:04 +0000"  >&lt;p&gt;I believe this is fixed now in the latest Doctrine 1.2. Can you test and confirm?&lt;/p&gt;</comment>
                    <comment id="10855" author="tom808" created="Tue, 24 Nov 2009 21:51:23 +0000"  >&lt;p&gt;It is not fixed with 1.2 RC1&lt;/p&gt;

&lt;p&gt;Same sql wich work fine with pdo_oci generates an error using the oracle adapter&lt;/p&gt;

&lt;p&gt;&amp;lt;p&amp;gt;&lt;br/&gt;
    &amp;lt;b&amp;gt;Message:&amp;lt;/b&amp;gt; ORA-01791: Kein mit SELECT ausgew&#228;hlter Ausdruck : SELECT s.code AS s_&lt;em&gt;code, c.code AS c&lt;/em&gt;&lt;em&gt;code, c.name AS c&lt;/em&gt;&lt;em&gt;name, c.is_activated AS c&lt;/em&gt;&lt;em&gt;is_activated, c.is_deleted AS c&lt;/em&gt;_is_deleted FROM spend_category s INNER JOIN company_spend_category c2 ON (s.code = c2.spendcategory_code) INNER JOIN company c ON c.code = c2.company_code WHERE s.code IN (SELECT a.code FROM ( SELECT DISTINCT s2.code FROM spend_category s2 INNER JOIN company_spend_category c4 ON (s2.code = c4.spendcategory_code) INNER JOIN company c3 ON c3.code = c4.company_code WHERE s2.code = &apos;37000000&apos; AND c3.is_deleted IS NOT NULL AND s2.is_deleted IS NOT NULL ORDER BY c3.name desc ) a WHERE ROWNUM &amp;lt;= 10) AND (s.code = &apos;37000000&apos; AND c.is_deleted IS NOT NULL AND s.is_deleted IS NOT NULL) ORDER BY c.name desc. &lt;/p&gt;

&lt;p&gt;Failing Query: &quot;SELECT s.code AS s_&lt;em&gt;code, c.code AS c&lt;/em&gt;&lt;em&gt;code, c.name AS c&lt;/em&gt;&lt;em&gt;name, c.is_activated AS c&lt;/em&gt;&lt;em&gt;is_activated, c.is_deleted AS c&lt;/em&gt;_is_deleted FROM spend_category s INNER JOIN company_spend_category c2 ON (s.code = c2.spendcategory_code) INNER JOIN company c ON c.code = c2.company_code WHERE s.code IN (SELECT a.code FROM ( SELECT DISTINCT s2.code FROM spend_category s2 INNER JOIN company_spend_category c4 ON (s2.code = c4.spendcategory_code) INNER JOIN company c3 ON c3.code = c4.company_code WHERE s2.code = &apos;37000000&apos; AND c3.is_deleted IS NOT NULL AND s2.is_deleted IS NOT NULL ORDER BY c3.name desc ) a WHERE ROWNUM &amp;lt;= 10) AND (s.code = &apos;37000000&apos; AND c.is_deleted IS NOT NULL AND s.is_deleted IS NOT NULL) ORDER BY c.name desc&quot;&amp;lt;/p&amp;gt;&lt;/p&gt;</comment>
                    <comment id="10856" author="jwage" created="Tue, 24 Nov 2009 21:53:02 +0000"  >&lt;p&gt;I can&apos;t reproduce the issue in a test case. Can you help me with that? When I test what you&apos;re describing I get the results that are expected.&lt;/p&gt;</comment>
                    <comment id="10862" author="tom808" created="Wed, 25 Nov 2009 09:39:55 +0000"  >&lt;p&gt;Hi Jon,&lt;/p&gt;

&lt;p&gt;if i undestand the last comment correctly this issue will be fixed in 1.2 RC2.&lt;/p&gt;

&lt;p&gt;I have reviewed lots of existing test cases but did not find an example where pdo_oci or oracle adapter is used.&lt;/p&gt;

&lt;p&gt;Can you please forward the test case you have created for &lt;a href=&quot;http://www.doctrine-project.org/jira/browse/DC-278&quot; title=&quot;Invalid qubquery generated if using oracle adapter instead of pdo_oci&quot;&gt;DC-278&lt;/a&gt; to me? I will  use this as a template for any further issues and hopefuly reduce your efforts.&lt;/p&gt;

&lt;p&gt;Kind regards&lt;br/&gt;
Tom&lt;/p&gt;

&lt;p&gt;&amp;gt; Jonathan H. Wage updated &lt;a href=&quot;http://www.doctrine-project.org/jira/browse/DC-278&quot; title=&quot;Invalid qubquery generated if using oracle adapter instead of pdo_oci&quot;&gt;DC-278&lt;/a&gt;:&lt;br/&gt;
&amp;gt; --------------------------------&lt;br/&gt;
&amp;gt;&lt;br/&gt;
&amp;gt;    Fix Version/s: 1.2.0-RC2&lt;br/&gt;
&amp;gt;                       (was: 1.2.0-RC1)&lt;/p&gt;

</comment>
                    <comment id="11160" author="tom808" created="Thu, 10 Dec 2009 14:50:55 +0000"  >&lt;p&gt;I do believe that I have found the reason and it is still an issue with Doctrine 1.2.1 &lt;/p&gt;

&lt;p&gt;Doctrine generate the following subquery which is processed in Doctrine_Query:: getLimitSubquery(). &lt;/p&gt;

&lt;p&gt;SELECT b.id FROM &lt;br/&gt;
	(&lt;br/&gt;
		SELECT a.*, ROWNUM AS doctrine_rownum FROM	&lt;br/&gt;
		(&lt;br/&gt;
			SELECT DISTINCT i.id, i.lft &lt;br/&gt;
			FROM item i &lt;br/&gt;
			INNER JOIN oum o ON i.oum_id = o.id AND (o.is_deleted IS NOT NULL) &lt;br/&gt;
			INNER JOIN item_type i2 ON i.type_id = i2.id AND (i2.is_deleted IS NOT NULL)&lt;br/&gt;
			INNER JOIN item_translation i3 ON i.id = i3.id &lt;br/&gt;
			LEFT JOIN attachment a ON i.id = a.item_id AND (a.is_deleted = 0) &lt;br/&gt;
			WHERE i.bundling_id = ? &lt;br/&gt;
			ORDER BY i.lft &lt;br/&gt;
		) a  &lt;br/&gt;
	) b &lt;br/&gt;
WHERE doctrine_rownum BETWEEN 3 AND 4&lt;/p&gt;


&lt;p&gt;This function replaces the table alias names. It looks like that the first occurance of &quot;a&quot; is detected and the inner alias for table attachment &quot;a&quot; is replaced by &quot;a2&quot; - that&apos;s fine. But also the outer table alias &quot;a&quot; is replaced by &quot;a2&quot; The result will be&lt;/p&gt;

&lt;p&gt;SELECT b.id FROM &lt;br/&gt;
	(&lt;br/&gt;
		SELECT a.*, ROWNUM AS doctrine_rownum FROM	&lt;br/&gt;
		(&lt;br/&gt;
			&lt;span class=&quot;error&quot;&gt;&amp;#91;...&amp;#93;&lt;/span&gt;&lt;br/&gt;
			LEFT JOIN attachment a2 ON i.id = a2.item_id AND (a2.is_deleted = 0) &lt;br/&gt;
			WHERE i.bundling_id = ? &lt;br/&gt;
			ORDER BY i.lft &lt;br/&gt;
		) a2 &#61663; !!!!!!  &lt;br/&gt;
	) b &lt;/p&gt;

&lt;p&gt;&#8222;a&quot; is selected but the alias has been changed to &#8222;a2&quot; and this will cause an sql error.&lt;/p&gt;

&lt;p&gt;It looks like that this bug will only raise if a table is used in the subquery which starts with an &quot;a&quot;&lt;/p&gt;</comment>
                    <comment id="11176" author="tom808" created="Fri, 11 Dec 2009 16:47:18 +0000"  >&lt;p&gt;As a workaround i have change &quot;a&quot; to &quot;x&quot; in the Doctrine_Connection_Oracle::_createLimitSubquery()&lt;/p&gt;

&lt;p&gt;As far as no table in our projekt starts with character &quot;x&quot; this works fine for me.&lt;/p&gt;

&lt;p&gt;By the way: Shouldn&apos;t it be $this-&amp;gt;quoteIdentifier(&apos;a&apos;) . &apos;.&lt;b&gt;&apos; instead of just a.&lt;/b&gt; ??&lt;/p&gt;

&lt;p&gt;original code:&lt;br/&gt;
                    $query = &apos;SELECT b.&apos;.$column.&apos; FROM ( &apos;.&lt;br/&gt;
                                 &apos;SELECT a.*, ROWNUM AS doctrine_rownum FROM ( &apos;&lt;br/&gt;
                                   . $query . &apos; ) &apos; . $this-&amp;gt;quoteIdentifier(&apos;a&apos;) . &apos; &apos;.&lt;br/&gt;
                              &apos; ) &apos; . $this-&amp;gt;quoteIdentifier(&apos;b&apos;) . &apos; &apos;.&lt;br/&gt;
                              &apos;WHERE doctrine_rownum BETWEEN &apos; . $min .  &apos; AND &apos; . $max;&lt;/p&gt;

&lt;p&gt;modified code:&lt;br/&gt;
                    $query = &apos;SELECT b.&apos;.$column.&apos; FROM ( &apos;.&lt;br/&gt;
                                 &apos;SELECT x.*, ROWNUM AS doctrine_rownum FROM ( &apos;&lt;br/&gt;
                                   . $query . &apos; ) &apos; . $this-&amp;gt;quoteIdentifier(&apos;x&apos;) . &apos; &apos;.&lt;br/&gt;
                              &apos; ) &apos; . $this-&amp;gt;quoteIdentifier(&apos;b&apos;) . &apos; &apos;.&lt;br/&gt;
                              &apos;WHERE doctrine_rownum BETWEEN &apos; . $min .  &apos; AND &apos; . $max;&lt;/p&gt;</comment>
                    <comment id="13195" author="jwage" created="Tue, 8 Jun 2010 15:01:45 +0000"  >&lt;p&gt;Can you provide the change that fixes the problem for you as a diff so we can test it?&lt;/p&gt;</comment>
                    <comment id="13244" author="tom808" created="Wed, 9 Jun 2010 03:37:49 +0000"  >&lt;p&gt;Hi Jon,&lt;/p&gt;

&lt;p&gt;long time with no hear from you. Hope you are well!&lt;/p&gt;

&lt;p&gt;I am sorry, we did not fix this bug really. As writte above we have just implemented a work around by choosing a different character (&quot;x&quot; instead of &quot;a&quot;) for the name of the generated sub query alias. This works fine with our data model (no table starts with &quot;x&quot;) but may cause the same error with other data models.&lt;/p&gt;

&lt;p&gt;At all: There was too much trouble in this project last year. Due to this we made the decision to go ahead with pdo_oci to finish the project in time.&lt;/p&gt;

&lt;p&gt;Kind regards&lt;br/&gt;
Thomas&lt;/p&gt;</comment>
                    <comment id="13254" author="jwage" created="Wed, 9 Jun 2010 13:02:31 +0000"  >&lt;p&gt;I&apos;ll leave this open if someone runs across the same problem, a test case showing the issue would help with pin pointing the problem area in the code.&lt;/p&gt;</comment>
                </comments>
                    <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>
</channel>
</rss>