diff --git a/libraries/DBQbe.class.php b/libraries/DBQbe.class.php
index af83e87ec3..0e7f8fedd2 100644
--- a/libraries/DBQbe.class.php
+++ b/libraries/DBQbe.class.php
@@ -1370,26 +1370,32 @@ class PMA_DbQbe
}
} // end while
- // Create LEFT JOINS out of Relations
- if (count($all_tables) > 0) {
- // Get tables and columns with valid where clauses
- $valid_where_clauses = $this->_getWhereClauseTablesAndColumns();
- $where_clause_tables = $valid_where_clauses['where_clause_tables'];
- $where_clause_columns = $valid_where_clauses['where_clause_columns'];
- // Get master table
- $master = $this->_getMasterTable(
- $all_tables, $all_columns,
- $where_clause_columns, $where_clause_tables
- );
- $from_clause = PMA_Util::backquote($master)
- . PMA_getRelatives($all_tables, $master);
+ if (isset($_POST['useJoins'])) {
+ // Create LEFT JOINS out of Relations
+ if (count($all_tables) > 0) {
+ // Get tables and columns with valid where clauses
+ $valid_where_clauses = $this->_getWhereClauseTablesAndColumns();
+ $where_clause_tables = $valid_where_clauses['where_clause_tables'];
+ $where_clause_columns = $valid_where_clauses['where_clause_columns'];
+ // Get master table
+ $master = $this->_getMasterTable(
+ $all_tables, $all_columns,
+ $where_clause_columns, $where_clause_tables
+ );
+ $from_clause = PMA_Util::backquote($master)
+ . PMA_getRelatives($all_tables, $master);
- } // end if (count($all_tables) > 0)
+ } // end if (count($all_tables) > 0)
+ }
// In case relations are not defined, just generate the FROM clause
// from the list of tables, however we don't generate any JOIN
if (empty($from_clause)) {
- $from_clause = implode(', ', $all_tables);
+ $backQuoted = array();
+ foreach ($all_tables as $table) {
+ $backQuoted[] = PMA_Util::backquote($table);
+ }
+ $from_clause = implode(', ', $backQuoted);
}
} // end count($_POST['criteriaColumn']) > 0
@@ -1432,6 +1438,14 @@ class PMA_DbQbe
$html_output .= $this->_getSavedSearchesField();
}
+ $html_output .= '
';
+ $html_output .= '';
+
$html_output .= '