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



      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 ) )}


      {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 ) )}


        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


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


            • Created:

              Time Tracking

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