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

    XMLWordPrintable

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

      Attachments

        Activity

          People

            Unassigned Unassigned
            pedro.resende-obsolete@ez.no 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