Automattic / Automattic/HyperDB

Cannot create new post when HyperDB is activated

Open
#104 4 comments 0 reactions 0 assignees View on GitHub
Dominant language
PHP
Stars
150
Forks
28
PR merge metrics
No merged PRs in 30d

Description

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.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.