MariaDB: don't display checks with the same name from another table (bug #1135)

This commit is contained in:
Jakub Vrana
2026-02-08 08:38:50 +01:00
parent 1b2354cdae
commit 83301e37da
2 changed files with 2 additions and 1 deletions

View File

@@ -7,6 +7,7 @@
- Display uneditable fields in edit form
- Shorten all but numeric and date types in select
- Fix escaping spaces in cookie value (bug #1208)
- MariaDB: don't display checks with the same name from another table (bug #1135)
- PostgreSQL: Offer foreign keys in create table
- PostgreSQL: Add missing parentheses to CHECK export
- PostgreSQL: Allow creating NOT DEFERRABLE foreign keys

View File

@@ -269,7 +269,7 @@ abstract class SqlDriver {
// 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
JOIN INFORMATION_SCHEMA.TABLE_CONSTRAINTS t ON c.CONSTRAINT_SCHEMA = t.CONSTRAINT_SCHEMA AND c.CONSTRAINT_NAME = t.CONSTRAINT_NAME" . ($this->conn->flavor == 'maria' ? " AND c.TABLE_NAME = t.TABLE_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'", $this->conn); // ignore default IS NOT NULL checks in PostrgreSQL