diff --git a/adminer/drivers/pgsql.inc.php b/adminer/drivers/pgsql.inc.php index 733b4c5b..5e7b5c64 100644 --- a/adminer/drivers/pgsql.inc.php +++ b/adminer/drivers/pgsql.inc.php @@ -227,7 +227,10 @@ if (isset($_GET["pgsql"])) { } function limit1($table, $query, $where) { - return (preg_match('~^INTO~', $query) ? limit($query, $where, 1) : "$query WHERE ctid = (SELECT ctid FROM " . table($table) . "$where LIMIT 1)"); + return (preg_match('~^INTO~', $query) + ? limit($query, $where, 1) + : " $query WHERE ctid = (SELECT ctid FROM " . table($table) . "$where LIMIT 1)" + ); } function db_collation($db, $collations) { diff --git a/adminer/drivers/sqlite.inc.php b/adminer/drivers/sqlite.inc.php index 9d8efbb3..454ca9bd 100644 --- a/adminer/drivers/sqlite.inc.php +++ b/adminer/drivers/sqlite.inc.php @@ -244,7 +244,10 @@ if (isset($_GET["sqlite"]) || isset($_GET["sqlite2"])) { function limit1($table, $query, $where) { global $connection; - return ($connection->result("SELECT sqlite_compileoption_used('ENABLE_UPDATE_DELETE_LIMIT')") ? limit($query, $where, 1) : " $query$where"); //! limit + return (preg_match('~^INTO~', $query) || $connection->result("SELECT sqlite_compileoption_used('ENABLE_UPDATE_DELETE_LIMIT')") + ? limit($query, $where, 1) + : " $query WHERE rowid = (SELECT rowid FROM " . table($table) . "$where LIMIT 1)" + ); } function db_collation($db, $collations) { diff --git a/changes.txt b/changes.txt index 8e8a2dce..3e2c483a 100644 --- a/changes.txt +++ b/changes.txt @@ -9,8 +9,8 @@ MySQL, PostgreSQL: Display warnings MySQL: Add floor and ceil select functions MySQL: Add FIND_IN_SET search operator MariaDB: Support JSON since MariaDB 10.2 +SQLite, PostgreSQL: Limit rows in data manipulation without unique key PostgreSQL: Support routines -PostgreSQL: Limit rows in data manipulation without unique key PostgreSQL: Allow editing views with uppercase letters (bug #467) PostgreSQL: Allow now() as default value (bug #525) SimpleDB: Document that allow_url_fopen is required