!!!TEST depth 2 composite with check on it, which will be propagated to table.
scalar test = sql"INTEGER";
struct a {
test @check (_ != 123);
};
struct b {
a_field: a @check (_.test != 246);
};
table Example {
b;
};
!!!RESULT
-- updated: depth 2 composite with check on it, which will be propagated to table. --
CREATE DOMAIN test AS INTEGER;
CREATE TYPE a AS (
test test
);
CREATE TYPE b AS (
a_field a
);
CREATE TABLE examples (
b b NOT NULL
, CONSTRAINT composite_nullability_check CHECK ((b IS NULL OR b.a_field IS NOT NULL) AND (b.a_field IS NULL OR b.a_field.test IS NOT NULL))
, CONSTRAINT examples_b_check CHECK (b.a_field.test <> 246 AND b.a_field.test <> 123)
);
-- updated: cleanup schema changes --
DROP TABLE examples;
DROP TYPE b;
DROP TYPE a;
DROP DOMAIN test;