Skip to content

Cannot create new post when HyperDB is activated #104

Open
@harryzhou1987

Description

@harryzhou1987

Hi there,

I just face an issue when we activate HyperDB plugin in our wordpress. I cannot create post an other taxomony related actions.

We tried different combination between wordpress version 6.0.2, 6.1 and HyperDB1.8 and 1.9 but the same error exists.

The full error is like below:
[Thu Nov 10 02:56:39.541899 2022] [php:notice] [pid 319] [client 43.134.152.59:59479] WordPress database error Expression #1 of ORDER BY clause is not in SELECT list, references column 'wp_db.t.name' which is not in SELECT list; this is incompatible with DISTINCT for query \n\t\t\tSELECT DISTINCT t.term_id, tr.object_id\n\t\t\tFROM wp_terms AS t INNER JOIN wp_term_taxonomy AS tt ON t.term_id = tt.term_id INNER JOIN wp_term_relationships AS tr ON tr.term_taxonomy_id = tt.term_taxonomy_id\n\t\t\tWHERE tt.taxonomy IN ('category', 'post_tag', 'post_format') AND tr.object_id IN (7)\n\t\t\tORDER BY t.name ASC\n\t\t\t\n\t\t made by WP_Term_Query::get_terms

To enable hyperdb, we

  • add db-config.php in root directory and only add below for the master node.
    'write' => 1,
    'read' => 1,
  • add db.php in wp-content/
  • define DB_CONFIG_FILE in wp-config.php file

The mysql version is 8.0.

I have run the SQL query to the database and it can be easily fixed with add t.name in the select or remove the distinct. However, I don't know how hyperDB can trigger WP_Term_Query::get_terms and generate this error?

Can you have a look and give us some guidance?
Thank you.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions