You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Depending on user's actual permissions the results in information_schema now change. The primary change (and the cause for our trouble) is column REFERENCED_TABLE_NAME in table REFERENTIAL_CONSTRAINTS being nullable now. This query is similar to what you use...
SELECT
`TABLE_SCHEMA`,
`TABLE_NAME`,
`CONSTRAINT_NAME`,
(SELECT
`DELETE_RULE`
FROM
`INFORMATION_SCHEMA`.`REFERENTIAL_CONSTRAINTS`
WHERE
`REFERENTIAL_CONSTRAINTS`.`CONSTRAINT_NAME` = `KEY_COLUMN_USAGE`.`CONSTRAINT_NAME`
AND `REFERENTIAL_CONSTRAINTS`.`CONSTRAINT_SCHEMA` = `KEY_COLUMN_USAGE`.`CONSTRAINT_SCHEMA`) AS `DELETE_RULE`
FROM
`INFORMATION_SCHEMA`.`KEY_COLUMN_USAGE`
WHERE
`TABLE_SCHEMA` IN ('a' , 'b')
AND `TABLE_NAME` = 'test'
AND `CONSTRAINT_NAME` <> 'PRIMARY'
AND `REFERENCED_TABLE_NAME` IS NOT NULL;
... and it results in...
+--------------+------------+-----------------+-------------+
| TABLE_SCHEMA | TABLE_NAME | CONSTRAINT_NAME | DELETE_RULE |
+--------------+------------+-----------------+-------------+
| a | test | constraint | NULL |
| b | test | constraint | RESTRICT |
+--------------+------------+-----------------+-------------+
2 rows in set (0,018 sec)
... where the NULL is what confuses your code.
The text was updated successfully, but these errors were encountered:
Steps to reproduce
Let's create a test case:
Scaffolding this with user
test
fails.The issue
Scaffolding
a.test
fails with something like...... where it succeeds for
b.test
.Further technical details
We have traced that to a change in MariaDB, referenced with MDEV-32500 Information schema leaks table names and structure to unauthorized users.
Depending on user's actual permissions the results in
information_schema
now change. The primary change (and the cause for our trouble) is columnREFERENCED_TABLE_NAME
in tableREFERENTIAL_CONSTRAINTS
being nullable now. This query is similar to what you use...... and it results in...
... where the
NULL
is what confuses your code.The text was updated successfully, but these errors were encountered: