PostgreSQL-For-Wordpress / postgresql-for-wordpress

A maintained fork of https://wordpress.org/plugins/postgresql-for-wordpress/
GNU General Public License v2.0
209 stars 68 forks source link

After fresh install, site health does not work #86

Closed dilyanpalauzov closed 6 months ago

dilyanpalauzov commented 7 months ago

I install a fresh site with WP4PG 3.0. Then I go to site-health.php and see

[ERROR: syntax error at or near "'table'" LINE 1: SELECT TABLE_NAME AS 'table', TABLE_ROWS AS 'rows', SUM(data... ^] SELECT TABLE_NAME AS 'table', TABLE_ROWS AS 'rows', SUM(data_length + index_length) as 'bytes' FROM information_schema.TABLES WHERE TABLE_SCHEMA = 'blog_at' AND TABLE_NAME IN ('wp_comments','wp_options','wp_posts','wp_terms','wp_users') GROUP BY TABLE_NAME;

Warning: Undefined array key "wp_comments" in /at/wp-admin/includes/class-wp-site-health.php on line 3595

Warning: Attempt to read property "rows" on null in /at/wp-admin/includes/class-wp-site-health.php on line 3595

Warning: Undefined array key "wp_options" in /at/wp-admin/includes/class-wp-site-health.php on line 3595

Warning: Attempt to read property "rows" on null in /at/wp-admin/includes/class-wp-site-health.php on line 3595

Warning: Undefined array key "wp_posts" in /at/wp-admin/includes/class-wp-site-health.php on line 3595

Warning: Attempt to read property "rows" on null in /at/wp-admin/includes/class-wp-site-health.php on line 3595

Warning: Undefined array key "wp_terms" in /at/wp-admin/includes/class-wp-site-health.php on line 3595

Warning: Attempt to read property "rows" on null in /at/wp-admin/includes/class-wp-site-health.php on line 3595

Warning: Undefined array key "wp_users" in /at/wp-admin/includes/class-wp-site-health.php on line 3595

Warning: Attempt to read property "rows" on null in /at/wp-admin/includes/class-wp-site-health.php on line 3595

The tables wp_users, wp_posts, wp_options do exist.

mattbucci commented 6 months ago

Running the build from PR: https://github.com/PostgreSQL-For-Wordpress/postgresql-for-wordpress/pull/76

Site health is working for me, but I'm getting a different set of errors:

Warning: Undefined property: PgSql\Connection::$client_info in /mnt/shared/sites/monad/wp-admin/includes/class-wp-debug-data.php on line 869

Warning: Undefined variable $variableName in /mnt/shared/sites/monad/wp-content/plugins/pg4wp/rewriters/ShowVariablesSQLRewriter.php on line 9

Warning: pg_query(): Query failed: ERROR: syntax error at or near "LIKE" LINE 1: SHOW VARIABLES LIKE 'max_allowed_packet' ^ in /mnt/shared/sites/monad/wp-content/plugins/pg4wp/driver_pgsql.php on line 497

Warning: Undefined variable $variableName in /mnt/shared/sites/monad/wp-content/plugins/pg4wp/rewriters/ShowVariablesSQLRewriter.php on line 9

Warning: pg_query(): Query failed: ERROR: syntax error at or near "LIKE" LINE 1: SHOW VARIABLES LIKE 'max_connections' ^ in /mnt/shared/sites/monad/wp-content/plugins/pg4wp/driver_pgsql.php on line 497
mattbucci commented 6 months ago

I need to update the SHOW VARIABLES rewriter, This is the general format

SELECT name as "Variable_name", setting as "Value" FROM pg_settings WHERE name = 'max_connections';

The site health screen queries for a variable max_allowed_packet which does not exist in postgres though.