Skip to content

information_schema.table_constraints reports ENFORCED=YES for not enforced foreign keys. #348

Description

@jvliwanag

Given the following schema:

CREATE TABLE `MyReferencedTable`(
  `MyReferencedId` INT64 NOT NULL
) PRIMARY KEY (`MyReferencedId`);

CREATE TABLE `MyTable`(
  `MyId` INT64 NOT NULL,
  `MyData` INT64,
  CONSTRAINT `MyDataFk` FOREIGN KEY (`MyData`)
    REFERENCES `MyReferencedTable` (`MyReferencedId`) NOT ENFORCED
) PRIMARY KEY (`MyId`);

We still find that:

spanner> select enforced from information_schema.table_constraints where constraint_name='MyDataFk';
+----------+
| enforced |
+----------+
| YES      |
+----------+
1 rows in set (3.628125ms)

Note that not enforced seem to work fine on the emulator, just misreported on information_schema.

On prod spanner, there is no such reporting issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions