Foreign key on different database
- Dominant language
- Go
- Stars
- 24.4k
- Forks
- 873
- Avg merge
- 1d 5h
- Merged PRs (30d)
- 108
Description
The following does not work:
**Using dolt sql:**
```SQL
CREATE DATABASE parent_schema;
CREATE TABLE parent_schema.parent(
id INT,
PRIMARY KEY(id)
);
CREATE DATABASE child_schema;
CREATE TABLE child_schema.child(
id INT,
parent_id INT,
PRIMARY KEY(id),
CONSTRAINT parent_ref FOREIGN KEY(parent_id) REFERENCES parent_schema.parent(id)
);
```
It produces the error:
> table not found: parent
But still creates a table without the foreign key:
```SQL
describe child_schema.child;
```
Produces:
> +-----------+------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-----------+------+------+-----+---------+-------+
| id | int | NO | PRI | | |
| parent_id | int | YES | | | |
+-----------+------+------+-----+---------+-------+
Am I missing something?
_Tried with dolt version 0.36.0 and 0.37.6._
PS: Yes, my example is very much inspired by #1104
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.