mirror of
https://github.com/PostgreSQL-For-Wordpress/postgresql-for-wordpress.git
synced 2025-07-29 09:17:14 +02:00
Log the SQL for errors in wpsql_insert_id
If the query produces an error, log the query which produced the error in addition to the insert statement which preceded it. This helped me track down an issue with a mis-named sequence from a bad MySQL->PostgreSQL migration. Signed-off-by: Kevin Locke <kevin@kevinlocke.name>
This commit is contained in:
@ -183,7 +183,9 @@
|
||||
elseif( PG4WP_DEBUG || PG4WP_ERROR_LOG)
|
||||
{
|
||||
$log = '['.microtime(true)."] wpsql_insert_id() was called with '$table' and '$ins_field'".
|
||||
" and generated an error. The latest INSERT query was :\n'$lastq'\n";
|
||||
" and returned the error:\n".pg_last_error().
|
||||
"\nFor the query:\n".$sql.
|
||||
"\nThe latest INSERT query was :\n'$lastq'\n";
|
||||
error_log( $log, 3, PG4WP_LOG.'pg4wp_errors.log');
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user