我有两个看起来像这样的表:
CREATE TABLE "schema"."TableOne" (
"TableOneID" SERIAL PRIMARY KEY,
"TimeRange" TSTZRANGE
);
CREATE TABLE "schema"."TableTwo" (
"TableTwoID" SERIAL PRIMARY KEY,
"TableOneID" INTEGER FOREIGN KEY ("SoulID") REFERENCES "schema"."TableOne" ("TableOneID")
"TimeRange" TSTZRANGE
);
我想确保"TableTwo"."TimeRange"
中的任何值都包含在"TableOne"."TimeRange"
中"TableOne"."TableOneID" = "TableTwo"."TableOneID"
我已多次阅读documentation(8.17.10。范围约束),无法找到实现这一目标的方法......任何想法?