Okay
  Public Ticket #3007560
SQL Syntax Error (LIMIT -1)
Closed

Comments

  • Ryan started the conversation

    I'm getting a database error because LIMIT -1 is being appended to my SQL query... 

    You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '-1' at line 1

    Here are the files reported reported by WP Query Monitor...

    1. WPDataTable->queryBasedConstruct()
      media/plugins/wpdatatables/source/class.wpdatatable.php:2548
    2. WPDataTable->fillFromData()
      media/plugins/wpdatatables/source/class.wpdatatable.php:3266
    3. wdtWpDataTableShortcodeHandler()
      media/plugins/wpdatatables/controllers/wdt_functions.php:693
    4. do_shortcode_tag()
      wp-includes/shortcodes.php:356
    5. preg_replace_callback()
      wp-includes/shortcodes.php:356
    6. do_shortcode()
      wp-includes/shortcodes.php:228

    The original query...

    SELECT p.ID, pm1.meta_value AS SORTID, pm2.meta_value AS NAME, pm3.meta_value AS URL
    FROM wp_term_relationships t
    INNER JOIN wp_posts p
    ON t.object_id = p.ID
    LEFT JOIN wp_postmeta pm1
    ON (pm1.post_id = p.ID
    AND pm1.meta_key = 'place_sortid')
    LEFT JOIN wp_postmeta pm2
    ON (pm2.post_id = p.ID
    AND pm2.meta_key = 'place_name')
    LEFT JOIN wp_postmeta pm3
    ON (pm3.post_id = p.ID
    AND pm3.meta_key = 'place_url')
    WHERE p.post_type = 'post'
    AND p.post_status = 'publish'
    AND t.term_taxonomy_id = '5'

    The query being sent to MySQL...  

    SELECT p.ID, pm1.meta_value AS SORTID, pm2.meta_value AS NAME, pm3.meta_value AS URL

    FROM wp_term_relationships t
    INNER JOIN wp_posts p
    ON t.object_id = p.ID
    LEFT JOIN wp_postmeta pm1
    ON (pm1.post_id = p.ID
    AND pm1.meta_key = 'place_sortid')
    LEFT JOIN wp_postmeta pm2
    ON (pm2.post_id = p.ID
    AND pm2.meta_key = 'place_name')
    LEFT JOIN wp_postmeta pm3
    ON (pm3.post_id = p.ID
    AND pm3.meta_key = 'place_url')
    WHERE p.post_type = 'post'
    AND p.post_status = 'publish'
    AND t.term_taxonomy_id = '5'
    LIMIT -1

    How can this be fixed?  

  •  2,572
    Aleksandar replied

    Hey Ryan.

    Sorry for the inconvenience.

    There's an issue with the latest version and it will be fixed with the next minor update as soon as our developers resolve the issue.

    At the moment, you can revert to v4.0.1 or temporarily disable server-side processing and add

    LIMIT 2000

    so the query returns only the initial 2.000 rows. Let me know if that helps or if you need me to send you the previous version of wpDataTables until this is resolved.

    Kind Regards, 

    Aleksandar Vuković
    [email protected]

    Rate my support

    wpDataTables: FAQ | Facebook | Twitter | InstagramFront-end and back-end demo | Docs

    Amelia: FAQ | Facebook | Twitter | InstagramAmelia demo sites | Docs | Discord Community

    You can try wpDataTables add-ons before purchasing on these sandbox sites:

    Powerful Filters | Gravity Forms Integration for wpDataTables | Formidable Forms Integration for wpDataTables | Master-Detail Tables

  • Ryan replied

    Thank you for the quick reply, Aleksandar. Without knowing when the next update will be released, I would appreciate if can you send v4.0.1, or at least the affected file(s), at your earliest convenience. I'd like to get it resolved ASAP.

  •   Aleksandar replied privately
  • Ryan replied

    Received, thank you Aleksandar. 

  •  2,572
    Aleksandar replied

    You're welcome, Ryan.

    If you have any further questions or issues, please feel free to open a new ticket, and we'll gladly help.

    Kind Regards, 

    Aleksandar Vuković
    [email protected]

    Rate my support

    wpDataTables: FAQ | Facebook | Twitter | InstagramFront-end and back-end demo | Docs

    Amelia: FAQ | Facebook | Twitter | InstagramAmelia demo sites | Docs | Discord Community

    You can try wpDataTables add-ons before purchasing on these sandbox sites:

    Powerful Filters | Gravity Forms Integration for wpDataTables | Formidable Forms Integration for wpDataTables | Master-Detail Tables