]> git.joonet.de Git - adminer.git/commitdiff
MS SQL: Support CHECK constraint
authorJakub Vrana <jakub@vrana.cz>
Sat, 22 Feb 2025 20:21:47 +0000 (21:21 +0100)
committerJakub Vrana <jakub@vrana.cz>
Sat, 22 Feb 2025 20:21:47 +0000 (21:21 +0100)
adminer/drivers/mssql.inc.php
adminer/include/editing.inc.php
changes.txt

index 4a44386f27a473e6c17042d97e522d5e4d900108..2529e8399ed7cf26c9f51dd7cd9d63c6d8938f44 100644 (file)
@@ -678,7 +678,7 @@ WHERE sys1.xtype = 'TR' AND sys2.name = " . q($table)
        }
 
        function support($feature) {
-               return preg_match('~^(comment|columns|database|drop_col|indexes|descidx|scheme|sql|table|trigger|view|view_trigger)$~', $feature); //! routine|
+               return preg_match('~^(check|comment|columns|database|drop_col|indexes|descidx|scheme|sql|table|trigger|view|view_trigger)$~', $feature); //! routine|
        }
 
        function driver_config() {
index 27c182b95b3f7817c50bd704a5457a9f38c1d916..5c6999507929dc8efbbfd198bfddf9a942f287ae 100644 (file)
@@ -539,8 +539,8 @@ function create_routine($routine, $row) {
 function check_constraints($table) {
        // MariaDB contains CHECK_CONSTRAINTS.TABLE_NAME, MySQL and PostrgreSQL not
        return get_key_vals("SELECT c.CONSTRAINT_NAME, CHECK_CLAUSE
-FROM information_schema.CHECK_CONSTRAINTS c
-JOIN information_schema.TABLE_CONSTRAINTS t ON c.CONSTRAINT_SCHEMA = t.CONSTRAINT_SCHEMA AND c.CONSTRAINT_NAME = t.CONSTRAINT_NAME
+FROM INFORMATION_SCHEMA.CHECK_CONSTRAINTS c
+JOIN INFORMATION_SCHEMA.TABLE_CONSTRAINTS t ON c.CONSTRAINT_SCHEMA = t.CONSTRAINT_SCHEMA AND c.CONSTRAINT_NAME = t.CONSTRAINT_NAME
 WHERE c.CONSTRAINT_SCHEMA = " . q($_GET["ns"] != "" ? $_GET["ns"] : DB) . "
 AND t.TABLE_NAME = " . q($table) . "
 AND CHECK_CLAUSE NOT LIKE '% IS NOT NULL'"); // ignore default IS NOT NULL checks in PostrgreSQL
index ded6505f1e398b77fd57cbc3f0ad7fe18489f5d0..71e2dfb850c21fc212ae7a56212f46a3721ed3bc 100644 (file)
@@ -1,6 +1,6 @@
 Adminer 4.17.0-dev:
 Hide index column options by default
-MySQL, PostgreSQL: Support CHECK constraint
+MySQL, PostgreSQL, MS SQL: Support CHECK constraint
 PostgreSQL: Link user defined types
 PostgreSQL: Constraint enum values in editing (bug #270)
 SQLite: Show all supported pragmas in Variables