[MDEV-9142] Adding Constraint with no database reference results in ERROR 1046 (3D000) at line 13: No database selected Created: 2015-11-17 Updated: 2016-04-23 Resolved: 2016-04-23 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Data Definition - Alter Table |
| Affects Version/s: | 5.5.41, 5.5.46, 5.5, 10.0, 10.1 |
| Fix Version/s: | 5.5.50, 10.0.25 |
| Type: | Bug | Priority: | Minor |
| Reporter: | Martin Walsh | Assignee: | Jan Lindström (Inactive) |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | upstream | ||
| Environment: |
Tested on Windows 2012, CentOS6.7 |
||
| Description |
|
When creating a table with a constraint which references a table without explicitly naming the database the statement fails with the following error.
The test statement used is as follows:
I'm using a local client to connect and run the test statement on MariaDB 5.5.41 - 46, on both Windows 2012 & CentOS 6.7....which all fail with the same error as above. You can work around this by either adding a database name to the reference, (kg_test1.group) or adding database context (i.e. use <db-name>) when logging in via the client, but it does not have to be the same database the table is being created in. This is a change in behaviour to MariaDB verisons prior to 5.5.41. |
| Comments |
| Comment by Elena Stepanova [ 2015-11-19 ] | |||||||||||||||||||||||||||||||||||||||||||||||
|
The change was introduced by this commit:
However, I can't say from the above whether the described side-effect is expected or not. Assigning to jplindst for an expert opinion. Here is the complete test case:
| |||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Jan Lindström (Inactive) [ 2016-04-07 ] | |||||||||||||||||||||||||||||||||||||||||||||||
|
commit 8bd6088800240a4e74ee58116f58d559cc4fc9f2 Use database from create table to foreign key database if | |||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Jan Lindström (Inactive) [ 2016-04-23 ] | |||||||||||||||||||||||||||||||||||||||||||||||
|
commit 19e3597e0c718a4cfdfe8789c7b4b11a4e0ba0c6 Use database from create table to foreign key database if |