Open hahnn opened 4 months ago
We should update https://github.com/PostgreSQL-For-Wordpress/postgresql-for-wordpress/blob/c7e3fbd50bb5363c84b39a611f65b9c699c7f63f/pg4wp/driver_pgsql_rewrite.php#L26 to include the SQL statement in the exception
if you could add var_dump($sql); die();
before the exception you can see the query.
It looks like the query should be contained in the function wpbc_is_field_in_table_exists
This error basically means the query isn't one of the following
SELECT|INSERT|REPLACE INTO|UPDATE|DELETE|DESCRIBE|ALTER TABLE|CREATE TABLE|DROP TABLE|SHOW INDEX|SHOW VARIABLES|SHOW TABLES|OPTIMIZE TABLE|SET NAMES|SHOW FULL COLUMNS|SHOW TABLE STATUS
Here's the function in question from this plugin. I think the issue is we have not implemented a rewriter for
SHOW COLUMNS FROM $table
This does not exist in Postgres
Expected format for return is
Field
Type
Null (is nullable)
Key (for some reason only PRI for Primary)
Default
Extra
/**
* Check if table exist
*
* @global $wpdb
* @param string $tablename
* @param $fieldname
* @return 0|1
*/
function wpbc_is_field_in_table_exists( $tablename , $fieldname) {
global $wpdb;
if (
( ( ! empty( $wpdb->prefix ) ) && ( strpos( $tablename, $wpdb->prefix ) === false ) )
|| ( '_' == $wpdb->prefix ) //FixIn: 8.7.3.16
) {
$tablename = $wpdb->prefix . $tablename;
}
if ( 0 ) {
$sql_check_table = "SELECT * FROM INFORMATION_SCHEMA.COLUMNS where TABLE_NAME='{$tablename}' AND TABLE_SCHEMA='{$wpdb->dbname}' ";
$res = $wpdb->get_results( $sql_check_table );
foreach ( $res as $fld ) {
if ( $fieldname === $fld->COLUMN_NAME ) {
return 1;
}
}
} else {
$sql_check_table = "SHOW COLUMNS FROM {$tablename}";
$res = $wpdb->get_results( $sql_check_table );
foreach ( $res as $fld ) {
if ( $fld->Field == $fieldname ) {
return 1;
}
}
}
return 0;
}
This is nearly the same as https://github.com/PostgreSQL-For-Wordpress/postgresql-for-wordpress/blob/v3/pg4wp/rewriters/ShowFullColumnsSQLRewriter.php
Per https://dev.mysql.com/doc/refman/8.0/en/show-columns.html
The optional EXTENDED keyword causes the output to include information about hidden columns that MySQL uses internally and are not accessible by users.
The optional FULL keyword causes the output to include the column collation and comments, as well as the privileges you have for each column.
I tried to activate Booking Calendar Extension after installing it.
The extension claimed it cannot be enabled because of a FATAl ERROR.
Unfortunately, there is absolutely nothing about that in pg4wp_errors.log file.
Then i took a look at my Apache HTTPD error log file and here is what I found about this issue: