Uploaded image for project: 'eZ Publish / Platform'
  1. eZ Publish / Platform
  2. EZP-21444

SQL query error in fetch('content', 'keyword') with some 'sort_by' parameters

    Details

      Description

      When using eZ Demo Blog, if you click on a tag from a Blog Post you'll get a fatal error

      Fatal error: mysqli_query(): Query error (1054): Unknown column 'ezcontentobject_name.content_version' in 'on clause'. Query: SELECT DISTINCT ezcontentobject_tree.node_id, ezkeyword.keyword, a0.sort_key_int FROM ezkeyword INNER JOIN ezkeyword_attribute_link ON (ezkeyword_attribute_link.keyword_id = ezkeyword.id) INNER JOIN ezcontentobject_attribute ON (ezcontentobject_attribute.id = ezkeyword_attribute_link.objectattribute_id) INNER JOIN ezcontentobject ON (ezcontentobject_attribute.version = ezcontentobject.current_version AND ezcontentobject_attribute.contentobject_id = ezcontentobject.id) INNER JOIN ezcontentobject_tree ON (ezcontentobject_tree.contentobject_id = ezcontentobject.id) INNER JOIN ezcontentclass ON (ezcontentclass.id = ezcontentobject.contentclass_id) INNER JOIN ezcontentobject_attribute a0 ON ( a0.contentobject_id = in /var/www/blog_resende_biz/ezpublish_legacy/lib/ezdb/classes/ezmysqlidb.php on line 419
      

      To reproduce this issue, using eZ Demo:

      1. Add a Blog Object
      2. Add a Blog Post
      3. Fill in the tag field with something
      4. Go the frontpage and access the Blog Post
      5. Click on the tag

      The query error happens when using the "attribute" or "class_name" sort_by parameter of the fetch('content', 'keyword') function.

      A more descriptive way the reproduce this issue it to use the following code in a template:

      {set $blogs = fetch( 'content', 'keyword', hash( 'alphabet', rawurldecode( $view_parameters.tag ),
          'classid', 'blog_post',
          'parent_node_id', $node.node_id,
          'offset', $view_parameters.offset,
          'sort_by', array( 'attribute', false(), 'blog_post/publication_date' ),
          'limit', $page_limit ) )}
      

      or

      {set $blogs = fetch( 'content', 'keyword', hash( 'alphabet', rawurldecode( $view_parameters.tag ),
          'classid', 'blog_post',
          'parent_node_id', $node.node_id,
          'offset', $view_parameters.offset,
          'sort_by', array( 'class_name', false() ),
          'limit', $page_limit ) )}
      

        Activity

        Pedro Resende (Inactive) created issue -
        Show
        Pedro Resende (Inactive) added a comment - Possible PR: https://github.com/ezsystems/ezpublish-legacy/pull/726
        Pedro Resende (Inactive) made changes -
        Field Original Value New Value
        Status Open [ 1 ] Confirmed [ 10037 ]
        Pedro Resende (Inactive) made changes -
        Description When using eZ Demo Blog, if you click on a tag from a Blog Post you'll get a fatal error

        {noformat}
        Fatal error: mysqli_query(): Query error (1054): Unknown column 'ezcontentobject_name.content_version' in 'on clause'. Query: SELECT DISTINCT ezcontentobject_tree.node_id, ezkeyword.keyword, a0.sort_key_int FROM ezkeyword INNER JOIN ezkeyword_attribute_link ON (ezkeyword_attribute_link.keyword_id = ezkeyword.id) INNER JOIN ezcontentobject_attribute ON (ezcontentobject_attribute.id = ezkeyword_attribute_link.objectattribute_id) INNER JOIN ezcontentobject ON (ezcontentobject_attribute.version = ezcontentobject.current_version AND ezcontentobject_attribute.contentobject_id = ezcontentobject.id) INNER JOIN ezcontentobject_tree ON (ezcontentobject_tree.contentobject_id = ezcontentobject.id) INNER JOIN ezcontentclass ON (ezcontentclass.id = ezcontentobject.contentclass_id) INNER JOIN ezcontentobject_attribute a0 ON ( a0.contentobject_id = in /var/www/blog_resende_biz/ezpublish_legacy/lib/ezdb/classes/ezmysqlidb.php on line 419
        {noformat}
        When using eZ Demo Blog, if you click on a tag from a Blog Post you'll get a fatal error

        {noformat}
        Fatal error: mysqli_query(): Query error (1054): Unknown column 'ezcontentobject_name.content_version' in 'on clause'. Query: SELECT DISTINCT ezcontentobject_tree.node_id, ezkeyword.keyword, a0.sort_key_int FROM ezkeyword INNER JOIN ezkeyword_attribute_link ON (ezkeyword_attribute_link.keyword_id = ezkeyword.id) INNER JOIN ezcontentobject_attribute ON (ezcontentobject_attribute.id = ezkeyword_attribute_link.objectattribute_id) INNER JOIN ezcontentobject ON (ezcontentobject_attribute.version = ezcontentobject.current_version AND ezcontentobject_attribute.contentobject_id = ezcontentobject.id) INNER JOIN ezcontentobject_tree ON (ezcontentobject_tree.contentobject_id = ezcontentobject.id) INNER JOIN ezcontentclass ON (ezcontentclass.id = ezcontentobject.contentclass_id) INNER JOIN ezcontentobject_attribute a0 ON ( a0.contentobject_id = in /var/www/blog_resende_biz/ezpublish_legacy/lib/ezdb/classes/ezmysqlidb.php on line 419
        {noformat}

        To reproduce this issue, using eZ Demo:

        1. Add a Blog Object
        2. Add a Blog Post
        3. Fill in the tag field with something
        4. Go the frontpage and access the Blog Post
        5. Click on the tag
        Pedro Resende (Inactive) made changes -
        Affects Version/s 2013.07 [ 12581 ]
        Pedro Resende (Inactive) made changes -
        Fix Version/s QA tracked issues [ 11072 ]
        Patrick Allaert (Inactive) made changes -
        Remaining Estimate 0 minutes [ 0 ]
        Time Spent 10 minutes [ 600 ]
        Worklog Id 38677 [ 38677 ]
        Patrick Allaert (Inactive) logged work - 03/Sep/13 9:05 PM
        • Time Spent:
          10 minutes
           

          PR review

        André Rømcke made changes -
        Status Confirmed [ 10037 ] InputQ [ 10001 ]
        André Rømcke made changes -
        Rank Ranked higher
        André Rømcke made changes -
        Rank Ranked higher
        André Rømcke made changes -
        Rank Ranked higher
        Patrick Allaert (Inactive) made changes -
        Status InputQ [ 10001 ] Development [ 3 ]
        Assignee Patrick Allaert [ patrick.allaert@ez.no ]
        Patrick Allaert (Inactive) made changes -
        Summary Fatal error: mysqli_query(): Query error (1054): Unknown column 'ezcontentobject_name.content_version' in 'on clause' while browsing blogs by tag SQL query error in fetch('content', 'keyword') with some 'sort_by' parameters
        Patrick Allaert (Inactive) made changes -
        Description When using eZ Demo Blog, if you click on a tag from a Blog Post you'll get a fatal error

        {noformat}
        Fatal error: mysqli_query(): Query error (1054): Unknown column 'ezcontentobject_name.content_version' in 'on clause'. Query: SELECT DISTINCT ezcontentobject_tree.node_id, ezkeyword.keyword, a0.sort_key_int FROM ezkeyword INNER JOIN ezkeyword_attribute_link ON (ezkeyword_attribute_link.keyword_id = ezkeyword.id) INNER JOIN ezcontentobject_attribute ON (ezcontentobject_attribute.id = ezkeyword_attribute_link.objectattribute_id) INNER JOIN ezcontentobject ON (ezcontentobject_attribute.version = ezcontentobject.current_version AND ezcontentobject_attribute.contentobject_id = ezcontentobject.id) INNER JOIN ezcontentobject_tree ON (ezcontentobject_tree.contentobject_id = ezcontentobject.id) INNER JOIN ezcontentclass ON (ezcontentclass.id = ezcontentobject.contentclass_id) INNER JOIN ezcontentobject_attribute a0 ON ( a0.contentobject_id = in /var/www/blog_resende_biz/ezpublish_legacy/lib/ezdb/classes/ezmysqlidb.php on line 419
        {noformat}

        To reproduce this issue, using eZ Demo:

        1. Add a Blog Object
        2. Add a Blog Post
        3. Fill in the tag field with something
        4. Go the frontpage and access the Blog Post
        5. Click on the tag
        When using eZ Demo Blog, if you click on a tag from a Blog Post you'll get a fatal error

        {noformat}
        Fatal error: mysqli_query(): Query error (1054): Unknown column 'ezcontentobject_name.content_version' in 'on clause'. Query: SELECT DISTINCT ezcontentobject_tree.node_id, ezkeyword.keyword, a0.sort_key_int FROM ezkeyword INNER JOIN ezkeyword_attribute_link ON (ezkeyword_attribute_link.keyword_id = ezkeyword.id) INNER JOIN ezcontentobject_attribute ON (ezcontentobject_attribute.id = ezkeyword_attribute_link.objectattribute_id) INNER JOIN ezcontentobject ON (ezcontentobject_attribute.version = ezcontentobject.current_version AND ezcontentobject_attribute.contentobject_id = ezcontentobject.id) INNER JOIN ezcontentobject_tree ON (ezcontentobject_tree.contentobject_id = ezcontentobject.id) INNER JOIN ezcontentclass ON (ezcontentclass.id = ezcontentobject.contentclass_id) INNER JOIN ezcontentobject_attribute a0 ON ( a0.contentobject_id = in /var/www/blog_resende_biz/ezpublish_legacy/lib/ezdb/classes/ezmysqlidb.php on line 419
        {noformat}

        To reproduce this issue, using eZ Demo:

        1. Add a Blog Object
        2. Add a Blog Post
        3. Fill in the tag field with something
        4. Go the frontpage and access the Blog Post
        5. Click on the tag

        The query error happens when using the _"attribute"_ or _"class_name"_ sort_by parameter of the .

        A more descriptive way the reproduce this issue it to use the following code in a template:
        {code}
        {set $blogs = fetch( 'content', 'keyword', hash( 'alphabet', rawurldecode( $view_parameters.tag ),
            'classid', 'blog_post',
            'parent_node_id', $node.node_id,
            'offset', $view_parameters.offset,
            'sort_by', array( 'attribute', false(), 'blog_post/publication_date' ),
            'limit', $page_limit ) )}
        {code}

        or

        {code}
        {set $blogs = fetch( 'content', 'keyword', hash( 'alphabet', rawurldecode( $view_parameters.tag ),
            'classid', 'blog_post',
            'parent_node_id', $node.node_id,
            'offset', $view_parameters.offset,
            'sort_by', array( 'class_name', false() ),
            'limit', $page_limit ) )}
        {code}
        Patrick Allaert (Inactive) made changes -
        Description When using eZ Demo Blog, if you click on a tag from a Blog Post you'll get a fatal error

        {noformat}
        Fatal error: mysqli_query(): Query error (1054): Unknown column 'ezcontentobject_name.content_version' in 'on clause'. Query: SELECT DISTINCT ezcontentobject_tree.node_id, ezkeyword.keyword, a0.sort_key_int FROM ezkeyword INNER JOIN ezkeyword_attribute_link ON (ezkeyword_attribute_link.keyword_id = ezkeyword.id) INNER JOIN ezcontentobject_attribute ON (ezcontentobject_attribute.id = ezkeyword_attribute_link.objectattribute_id) INNER JOIN ezcontentobject ON (ezcontentobject_attribute.version = ezcontentobject.current_version AND ezcontentobject_attribute.contentobject_id = ezcontentobject.id) INNER JOIN ezcontentobject_tree ON (ezcontentobject_tree.contentobject_id = ezcontentobject.id) INNER JOIN ezcontentclass ON (ezcontentclass.id = ezcontentobject.contentclass_id) INNER JOIN ezcontentobject_attribute a0 ON ( a0.contentobject_id = in /var/www/blog_resende_biz/ezpublish_legacy/lib/ezdb/classes/ezmysqlidb.php on line 419
        {noformat}

        To reproduce this issue, using eZ Demo:

        1. Add a Blog Object
        2. Add a Blog Post
        3. Fill in the tag field with something
        4. Go the frontpage and access the Blog Post
        5. Click on the tag

        The query error happens when using the _"attribute"_ or _"class_name"_ sort_by parameter of the .

        A more descriptive way the reproduce this issue it to use the following code in a template:
        {code}
        {set $blogs = fetch( 'content', 'keyword', hash( 'alphabet', rawurldecode( $view_parameters.tag ),
            'classid', 'blog_post',
            'parent_node_id', $node.node_id,
            'offset', $view_parameters.offset,
            'sort_by', array( 'attribute', false(), 'blog_post/publication_date' ),
            'limit', $page_limit ) )}
        {code}

        or

        {code}
        {set $blogs = fetch( 'content', 'keyword', hash( 'alphabet', rawurldecode( $view_parameters.tag ),
            'classid', 'blog_post',
            'parent_node_id', $node.node_id,
            'offset', $view_parameters.offset,
            'sort_by', array( 'class_name', false() ),
            'limit', $page_limit ) )}
        {code}
        When using eZ Demo Blog, if you click on a tag from a Blog Post you'll get a fatal error

        {noformat}
        Fatal error: mysqli_query(): Query error (1054): Unknown column 'ezcontentobject_name.content_version' in 'on clause'. Query: SELECT DISTINCT ezcontentobject_tree.node_id, ezkeyword.keyword, a0.sort_key_int FROM ezkeyword INNER JOIN ezkeyword_attribute_link ON (ezkeyword_attribute_link.keyword_id = ezkeyword.id) INNER JOIN ezcontentobject_attribute ON (ezcontentobject_attribute.id = ezkeyword_attribute_link.objectattribute_id) INNER JOIN ezcontentobject ON (ezcontentobject_attribute.version = ezcontentobject.current_version AND ezcontentobject_attribute.contentobject_id = ezcontentobject.id) INNER JOIN ezcontentobject_tree ON (ezcontentobject_tree.contentobject_id = ezcontentobject.id) INNER JOIN ezcontentclass ON (ezcontentclass.id = ezcontentobject.contentclass_id) INNER JOIN ezcontentobject_attribute a0 ON ( a0.contentobject_id = in /var/www/blog_resende_biz/ezpublish_legacy/lib/ezdb/classes/ezmysqlidb.php on line 419
        {noformat}

        To reproduce this issue, using eZ Demo:

        1. Add a Blog Object
        2. Add a Blog Post
        3. Fill in the tag field with something
        4. Go the frontpage and access the Blog Post
        5. Click on the tag

        The query error happens when using the _"attribute"_ or _"class_name"_ sort_by parameter of the _fetch('content', 'keyword')_ function.

        A more descriptive way the reproduce this issue it to use the following code in a template:
        {code}
        {set $blogs = fetch( 'content', 'keyword', hash( 'alphabet', rawurldecode( $view_parameters.tag ),
            'classid', 'blog_post',
            'parent_node_id', $node.node_id,
            'offset', $view_parameters.offset,
            'sort_by', array( 'attribute', false(), 'blog_post/publication_date' ),
            'limit', $page_limit ) )}
        {code}

        or

        {code}
        {set $blogs = fetch( 'content', 'keyword', hash( 'alphabet', rawurldecode( $view_parameters.tag ),
            'classid', 'blog_post',
            'parent_node_id', $node.node_id,
            'offset', $view_parameters.offset,
            'sort_by', array( 'class_name', false() ),
            'limit', $page_limit ) )}
        {code}
        Patrick Allaert (Inactive) logged work - 20/Sep/13 3:38 PM
        Show
        Patrick Allaert (Inactive) added a comment - New PR at: https://github.com/ezsystems/ezpublish-legacy/pull/765
        Patrick Allaert (Inactive) made changes -
        Time Spent 10 minutes [ 600 ] 5 hours, 40 minutes [ 20400 ]
        Worklog Id 39844 [ 39844 ]
        Patrick Allaert (Inactive) made changes -
        Status Development [ 3 ] Development review [ 10006 ]
        Show
        Patrick Allaert (Inactive) added a comment - Fixed in: eZ Publish master (merge commit): https://github.com/ezsystems/ezpublish-legacy/commit/fad9377ae35182df2a4bf71120734366a9eca52b eZ Publish master: https://github.com/ezsystems/ezpublish-legacy/commit/17484b3907e03bd1113ef2841a9a21f6b17a5710
        Patrick Allaert (Inactive) made changes -
        Status Development review [ 10006 ] Development Review done [ 10028 ]
        Fix Version/s 5.0 Maintenance [ 11287 ]
        Fix Version/s Ventoux [ 11282 ]
        Fix Version/s 5.1 Maintenance [ 12301 ]
        Fix Version/s 5.2 Maintenance [ 12782 ]
        Fix Version/s 5.2-dev [ 12300 ]
        Patrick Allaert (Inactive) made changes -
        Status Development Review done [ 10028 ] Documentation done [ 10011 ]
        Pedro Resende (Inactive) made changes -
        Status Documentation done [ 10011 ] QA [ 10008 ]
        Assignee Patrick Allaert [ patrick.allaert@ez.no ] Pedro Resende [ pedro.resende@ez.no ]
        Pedro Resende (Inactive) made changes -
        Assignee Pedro Resende [ pedro.resende@ez.no ] Joao Pingo [ joao.pingo@ez.no ]
        Joao Pingo (Inactive) made changes -
        Time Spent 5 hours, 40 minutes [ 20400 ] 6 hours, 10 minutes [ 22200 ]
        Worklog Id 41048 [ 41048 ]
        Joao Pingo (Inactive) logged work - 10/Oct/13 6:55 PM
        • Time Spent:
          30 minutes
           

          Testing

        Joao Pingo (Inactive) made changes -
        Status QA [ 10008 ] InputQ [ 10001 ]
        Assignee Joao Pingo [ joao.pingo@ez.no ]
        Joao Pingo (Inactive) made changes -
        Time Spent 6 hours, 10 minutes [ 22200 ] 1 day, 40 minutes [ 31200 ]
        Worklog Id 41056 [ 41056 ]
        Joao Pingo (Inactive) logged work - 11/Oct/13 12:34 PM
        • Time Spent:
          2 hours, 30 minutes
           

          Tested and sent back to InputQ

        André Rømcke made changes -
        Status InputQ [ 10001 ] Development [ 3 ]
        Assignee André Rømcke [ andre.romcke@ez.no ]
        André Rømcke made changes -
        Time Spent 1 day, 40 minutes [ 31200 ] 1 day, 50 minutes [ 31800 ]
        Worklog Id 41057 [ 41057 ]
        André Rømcke made changes -
        Status Development [ 3 ] Documentation done [ 10011 ]
        Joao Pingo (Inactive) made changes -
        Status Documentation done [ 10011 ] QA [ 10008 ]
        Assignee André Rømcke [ andre.romcke@ez.no ] Joao Pingo [ joao.pingo@ez.no ]
        Joao Pingo (Inactive) logged work - 14/Oct/13 5:47 PM
        • Time Spent:
          2 hours
           

          Testing in all versions

        Hide
        Joao Pingo (Inactive) added a comment -

        QA Approved

        Show
        Joao Pingo (Inactive) added a comment - QA Approved
        Joao Pingo (Inactive) made changes -
        Assignee Joao Pingo [ joao.pingo@ez.no ]
        Status QA [ 10008 ] Closed [ 6 ]
        Resolution Fixed [ 1 ]
        Joao Pingo (Inactive) made changes -
        Resolution Fixed [ 1 ]
        Status Closed [ 6 ] Reopened [ 4 ]
        Joao Pingo (Inactive) made changes -
        Time Spent 1 day, 50 minutes [ 31800 ] 1 day, 2 hours, 50 minutes [ 39000 ]
        Worklog Id 41154 [ 41154 ]
        Joao Pingo (Inactive) made changes -
        Status Reopened [ 4 ] Closed [ 6 ]
        Resolution Fixed [ 1 ]
        André Rømcke made changes -
        Workflow eZ Engineering Scrumban Workflow [ 57877 ] EZ* Development Workflow [ 84156 ]
        Alex Schuster made changes -
        Workflow EZ* Development Workflow [ 84156 ] EZEE Development Workflow [ 122794 ]
        Transition Time In Source Status Execution Times Last Executer Last Execution Date
        Open Open Confirmed Confirmed
        47m 33s 1 pedro.resende@ez.no 24/Aug/13 12:01 AM
        Confirmed Confirmed InputQ InputQ
        17d 8h 59m 1 André Rømcke 10/Sep/13 9:01 AM
        Development Development Development Review Development Review
        21h 5m 1 Patrick Allaert (Inactive) 20/Sep/13 3:40 PM
        Development Review Development Review Development Review done Development Review done
        4d 20h 56m 1 Patrick Allaert (Inactive) 25/Sep/13 12:37 PM
        Development Review done Development Review done Documentation Review done Documentation Review done
        38s 1 Patrick Allaert (Inactive) 25/Sep/13 12:38 PM
        QA QA InputQ InputQ
        13d 22h 47m 1 Joao Pingo (Inactive) 11/Oct/13 11:26 AM
        InputQ InputQ Development Development
        9d 11h 1m 2 André Rømcke 11/Oct/13 12:54 PM
        Development Development Documentation Review done Documentation Review done
        28s 1 André Rømcke 11/Oct/13 12:55 PM
        Documentation Review done Documentation Review done QA QA
        2d 7m 2 Joao Pingo (Inactive) 11/Oct/13 1:01 PM
        QA QA Closed Closed
        3d 4h 46m 1 Joao Pingo (Inactive) 14/Oct/13 5:47 PM
        Closed Closed Reopened Reopened
        1m 1 Joao Pingo (Inactive) 14/Oct/13 5:48 PM
        Reopened Reopened Closed Closed
        1s 1 Joao Pingo (Inactive) 14/Oct/13 5:48 PM

          People

          • Assignee:
            Unassigned
            Reporter:
            Pedro Resende (Inactive)
          • Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Time Tracking

              Estimated:
              Original Estimate - Not Specified
              Not Specified
              Remaining:
              Remaining Estimate - 0 minutes
              0m
              Logged:
              Time Spent - 1 day, 2 hours, 50 minutes
              1d 2h 50m