From 63104110a1201e4e6753a36d7e2c9781e5aeab71 Mon Sep 17 00:00:00 2001 From: Luis Henrique Mulinari Date: Tue, 3 Oct 2023 18:39:28 -0300 Subject: [PATCH] Append table alias --- lib/db-multiple-datasets-config.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/db-multiple-datasets-config.php b/lib/db-multiple-datasets-config.php index 970460665a..d905f51829 100644 --- a/lib/db-multiple-datasets-config.php +++ b/lib/db-multiple-datasets-config.php @@ -27,8 +27,8 @@ function query( $query ) { $regex = "/(?:FROM|JOIN|UPDATE|INTO|,)\s+`?($wpdb->base_prefix(\d+)?_?(?:\w+)+?)`?/i"; $query = preg_replace_callback( $regex, function ($match) use ( $wpdb ) { - return str_replace( $match[1], get_dataset_for_table( $wpdb->base_prefix, $match[1] ) . '.' . $match[1], $match[0] ); - },$query); + return str_replace( $match[1], get_dataset_for_table( $wpdb->base_prefix, $match[1] ) . '.' . $match[1] . ' ' . $match[1], $match[0] ); + }, $query ); $query .= ' ' . MULTIPLE_DATASET_QUERY_ANNOTATION;