소스 검색

test(compat): expect CHECK and FOREIGN KEY rejection at DDL

Tasks #61/#62 now reject both clauses with 0A000; drop the old
not-enforced limitation checks and assert the rejection instead.
PizzaSQL Bot 21 시간 전
부모
커밋
7fa3d0c52e
1개의 변경된 파일과 4개의 추가작업 그리고 7개의 파일을 삭제
  1. 4 7
      pkg/pgserver/compat_suite_test.go

+ 4 - 7
pkg/pgserver/compat_suite_test.go

@@ -127,13 +127,10 @@ func TestCompatibilitySuite(t *testing.T) {
 	expectCode("locking.for_update_0A000", `SELECT * FROM accounts FOR UPDATE`, "0A000")
 	expectCode("arrays.any_0A000", `SELECT * FROM accounts WHERE id = ANY('{1,2}')`, "0A000")
 
-	// Documented current limitation: CHECK and FOREIGN KEY are parsed but not
-	// enforced. A release that starts rejecting them will report "missing"
-	// here and the capability document must be updated.
-	expectOK("limitations.check_not_enforced", `CREATE TABLE checked (n INTEGER CHECK (n > 0))`)
-	expectOK("limitations.check_insert_violation", `INSERT INTO checked (n) VALUES (-1)`)
-	expectOK("limitations.foreign_key_not_enforced", `CREATE TABLE child (id INTEGER PRIMARY KEY, parent_id INTEGER, FOREIGN KEY (parent_id) REFERENCES accounts(id))`)
-	expectOK("limitations.orphan_insert", `INSERT INTO child (id, parent_id) VALUES (1, 999)`)
+	// CHECK and FOREIGN KEY are rejected at DDL instead of being silently
+	// discarded; enforce these rules in the application.
+	expectCode("ddl.check_0A000", `CREATE TABLE checked (n INTEGER CHECK (n > 0))`, "0A000")
+	expectCode("ddl.foreign_key_0A000", `CREATE TABLE child (id INTEGER PRIMARY KEY, parent_id INTEGER, FOREIGN KEY (parent_id) REFERENCES accounts(id))`, "0A000")
 
 	expectCode("errors.syntax_42601", `SELEC 1`, "42601")