Skip to content

Search Post Not Working Properly #98

@iqbaljayadi-tonjoo

Description

@iqbaljayadi-tonjoo

Hi,

Tried to setup WordPress with Postgre and testing some basic functions. When I tried to search posts on WP Admin (WP Admin --> Posts --> All Posts) here are the results:

  • Using single keyword: works properly
  • Using two or more keywords: gave wp debug error message and pagination was not displayed

Here's the error (WP Debug is on):

WordPress database error: [ERROR: syntax error at or near ")" LINE 3: OR wp_posts.post_status = 'private')))) AS count0, wp_posts.... ^]
SELECT FOUND_ROWS()

Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/wp-content/pg4wp/core.php(34) : eval()'d code:1854) in /var/www/html/wp-admin/admin-header.php on line 9

It seems that the regex on this line https://github.com/PostgreSQL-For-Wordpress/postgresql-for-wordpress/blob/v3/pg4wp/rewriters/SelectSQLRewriter.php#L28 needs to be fixed.

$sql = preg_replace('/\s+ORDER\s+BY\s+[^)]+/i', '', $sql);

Can someone give me a hint to fix this issue?

Thank you!

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions