|
|
@ -107,8 +107,8 @@ add schema element support:
|
|
|
|
|
|
|
|
|
|
|
|
,s "create table t (a int, b int);"
|
|
|
|
,s "create table t (a int, b int);"
|
|
|
|
$ CreateTable [Name Nothing "t"]
|
|
|
|
$ CreateTable [Name Nothing "t"]
|
|
|
|
[TableColumnDef $ ColumnDef (Name Nothing "a") (Just (TypeName [Name Nothing "int"])) Nothing []
|
|
|
|
[TableColumnDef $ ColumnDef (Name Nothing "a") (Just (TypeName [Name Nothing "int"])) []
|
|
|
|
,TableColumnDef $ ColumnDef (Name Nothing "b") (Just (TypeName [Name Nothing "int"])) Nothing []]
|
|
|
|
,TableColumnDef $ ColumnDef (Name Nothing "b") (Just (TypeName [Name Nothing "int"])) []]
|
|
|
|
False
|
|
|
|
False
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -327,35 +327,35 @@ todo: constraint characteristics
|
|
|
|
,s
|
|
|
|
,s
|
|
|
|
"create table t (a int not null);"
|
|
|
|
"create table t (a int not null);"
|
|
|
|
$ CreateTable [Name Nothing "t"]
|
|
|
|
$ CreateTable [Name Nothing "t"]
|
|
|
|
[TableColumnDef $ ColumnDef (Name Nothing "a") (Just (TypeName [Name Nothing "int"])) Nothing
|
|
|
|
[TableColumnDef $ ColumnDef (Name Nothing "a") (Just (TypeName [Name Nothing "int"]))
|
|
|
|
[ColConstraintDef Nothing ColNotNullConstraint]]
|
|
|
|
[ColConstraintDef Nothing ColNotNullConstraint]]
|
|
|
|
False
|
|
|
|
False
|
|
|
|
|
|
|
|
|
|
|
|
,s
|
|
|
|
,s
|
|
|
|
"create table t (a int constraint a_not_null not null);"
|
|
|
|
"create table t (a int constraint a_not_null not null);"
|
|
|
|
$ CreateTable [Name Nothing "t"]
|
|
|
|
$ CreateTable [Name Nothing "t"]
|
|
|
|
[TableColumnDef $ ColumnDef (Name Nothing "a") (Just (TypeName [Name Nothing "int"])) Nothing
|
|
|
|
[TableColumnDef $ ColumnDef (Name Nothing "a") (Just (TypeName [Name Nothing "int"]))
|
|
|
|
[ColConstraintDef (Just [Name Nothing "a_not_null"]) ColNotNullConstraint]]
|
|
|
|
[ColConstraintDef (Just [Name Nothing "a_not_null"]) ColNotNullConstraint]]
|
|
|
|
False
|
|
|
|
False
|
|
|
|
|
|
|
|
|
|
|
|
,s
|
|
|
|
,s
|
|
|
|
"create table t (a int unique);"
|
|
|
|
"create table t (a int unique);"
|
|
|
|
$ CreateTable [Name Nothing "t"]
|
|
|
|
$ CreateTable [Name Nothing "t"]
|
|
|
|
[TableColumnDef $ ColumnDef (Name Nothing "a") (Just (TypeName [Name Nothing "int"])) Nothing
|
|
|
|
[TableColumnDef $ ColumnDef (Name Nothing "a") (Just (TypeName [Name Nothing "int"]))
|
|
|
|
[ColConstraintDef Nothing ColUniqueConstraint]]
|
|
|
|
[ColConstraintDef Nothing ColUniqueConstraint]]
|
|
|
|
False
|
|
|
|
False
|
|
|
|
|
|
|
|
|
|
|
|
,s
|
|
|
|
,s
|
|
|
|
"create table t (a int primary key);"
|
|
|
|
"create table t (a int primary key);"
|
|
|
|
$ CreateTable [Name Nothing "t"]
|
|
|
|
$ CreateTable [Name Nothing "t"]
|
|
|
|
[TableColumnDef $ ColumnDef (Name Nothing "a") (Just (TypeName [Name Nothing "int"])) Nothing
|
|
|
|
[TableColumnDef $ ColumnDef (Name Nothing "a") (Just (TypeName [Name Nothing "int"]))
|
|
|
|
[ColConstraintDef Nothing (ColPrimaryKeyConstraint False)]]
|
|
|
|
[ColConstraintDef Nothing (ColPrimaryKeyConstraint False)]]
|
|
|
|
False
|
|
|
|
False
|
|
|
|
|
|
|
|
|
|
|
|
,testStatement ansi2011{ diAutoincrement = True }
|
|
|
|
,testStatement ansi2011{ diAutoincrement = True }
|
|
|
|
"create table t (a int primary key autoincrement);"
|
|
|
|
"create table t (a int primary key autoincrement);"
|
|
|
|
$ CreateTable [Name Nothing "t"]
|
|
|
|
$ CreateTable [Name Nothing "t"]
|
|
|
|
[TableColumnDef $ ColumnDef (Name Nothing "a") (Just (TypeName [Name Nothing "int"])) Nothing
|
|
|
|
[TableColumnDef $ ColumnDef (Name Nothing "a") (Just (TypeName [Name Nothing "int"]))
|
|
|
|
[ColConstraintDef Nothing (ColPrimaryKeyConstraint True)]]
|
|
|
|
[ColConstraintDef Nothing (ColPrimaryKeyConstraint True)]]
|
|
|
|
False
|
|
|
|
False
|
|
|
|
|
|
|
|
|
|
|
@ -369,7 +369,7 @@ references t(a,b)
|
|
|
|
,s
|
|
|
|
,s
|
|
|
|
"create table t (a int references u);"
|
|
|
|
"create table t (a int references u);"
|
|
|
|
$ CreateTable [Name Nothing "t"]
|
|
|
|
$ CreateTable [Name Nothing "t"]
|
|
|
|
[TableColumnDef $ ColumnDef (Name Nothing "a") (Just (TypeName [Name Nothing "int"])) Nothing
|
|
|
|
[TableColumnDef $ ColumnDef (Name Nothing "a") (Just (TypeName [Name Nothing "int"]))
|
|
|
|
[ColConstraintDef Nothing $ ColReferencesConstraint
|
|
|
|
[ColConstraintDef Nothing $ ColReferencesConstraint
|
|
|
|
[Name Nothing "u"] Nothing DefaultReferenceMatch
|
|
|
|
[Name Nothing "u"] Nothing DefaultReferenceMatch
|
|
|
|
DefaultReferentialAction DefaultReferentialAction]]
|
|
|
|
DefaultReferentialAction DefaultReferentialAction]]
|
|
|
@ -378,7 +378,7 @@ references t(a,b)
|
|
|
|
,s
|
|
|
|
,s
|
|
|
|
"create table t (a int references u(a));"
|
|
|
|
"create table t (a int references u(a));"
|
|
|
|
$ CreateTable [Name Nothing "t"]
|
|
|
|
$ CreateTable [Name Nothing "t"]
|
|
|
|
[TableColumnDef $ ColumnDef (Name Nothing "a") (Just (TypeName [Name Nothing "int"])) Nothing
|
|
|
|
[TableColumnDef $ ColumnDef (Name Nothing "a") (Just (TypeName [Name Nothing "int"]))
|
|
|
|
[ColConstraintDef Nothing $ ColReferencesConstraint
|
|
|
|
[ColConstraintDef Nothing $ ColReferencesConstraint
|
|
|
|
[Name Nothing "u"] (Just $ Name Nothing "a") DefaultReferenceMatch
|
|
|
|
[Name Nothing "u"] (Just $ Name Nothing "a") DefaultReferenceMatch
|
|
|
|
DefaultReferentialAction DefaultReferentialAction]]
|
|
|
|
DefaultReferentialAction DefaultReferentialAction]]
|
|
|
@ -387,7 +387,7 @@ references t(a,b)
|
|
|
|
,s
|
|
|
|
,s
|
|
|
|
"create table t (a int references u match full);"
|
|
|
|
"create table t (a int references u match full);"
|
|
|
|
$ CreateTable [Name Nothing "t"]
|
|
|
|
$ CreateTable [Name Nothing "t"]
|
|
|
|
[TableColumnDef $ ColumnDef (Name Nothing "a") (Just (TypeName [Name Nothing "int"])) Nothing
|
|
|
|
[TableColumnDef $ ColumnDef (Name Nothing "a") (Just (TypeName [Name Nothing "int"]))
|
|
|
|
[ColConstraintDef Nothing $ ColReferencesConstraint
|
|
|
|
[ColConstraintDef Nothing $ ColReferencesConstraint
|
|
|
|
[Name Nothing "u"] Nothing MatchFull
|
|
|
|
[Name Nothing "u"] Nothing MatchFull
|
|
|
|
DefaultReferentialAction DefaultReferentialAction]]
|
|
|
|
DefaultReferentialAction DefaultReferentialAction]]
|
|
|
@ -396,7 +396,7 @@ references t(a,b)
|
|
|
|
,s
|
|
|
|
,s
|
|
|
|
"create table t (a int references u match partial);"
|
|
|
|
"create table t (a int references u match partial);"
|
|
|
|
$ CreateTable [Name Nothing "t"]
|
|
|
|
$ CreateTable [Name Nothing "t"]
|
|
|
|
[TableColumnDef $ ColumnDef (Name Nothing "a") (Just (TypeName [Name Nothing "int"])) Nothing
|
|
|
|
[TableColumnDef $ ColumnDef (Name Nothing "a") (Just (TypeName [Name Nothing "int"]))
|
|
|
|
[ColConstraintDef Nothing $ ColReferencesConstraint
|
|
|
|
[ColConstraintDef Nothing $ ColReferencesConstraint
|
|
|
|
[Name Nothing "u"] Nothing MatchPartial
|
|
|
|
[Name Nothing "u"] Nothing MatchPartial
|
|
|
|
DefaultReferentialAction DefaultReferentialAction]]
|
|
|
|
DefaultReferentialAction DefaultReferentialAction]]
|
|
|
@ -405,7 +405,7 @@ references t(a,b)
|
|
|
|
,s
|
|
|
|
,s
|
|
|
|
"create table t (a int references u match simple);"
|
|
|
|
"create table t (a int references u match simple);"
|
|
|
|
$ CreateTable [Name Nothing "t"]
|
|
|
|
$ CreateTable [Name Nothing "t"]
|
|
|
|
[TableColumnDef $ ColumnDef (Name Nothing "a") (Just (TypeName [Name Nothing "int"])) Nothing
|
|
|
|
[TableColumnDef $ ColumnDef (Name Nothing "a") (Just (TypeName [Name Nothing "int"]))
|
|
|
|
[ColConstraintDef Nothing $ ColReferencesConstraint
|
|
|
|
[ColConstraintDef Nothing $ ColReferencesConstraint
|
|
|
|
[Name Nothing "u"] Nothing MatchSimple
|
|
|
|
[Name Nothing "u"] Nothing MatchSimple
|
|
|
|
DefaultReferentialAction DefaultReferentialAction]]
|
|
|
|
DefaultReferentialAction DefaultReferentialAction]]
|
|
|
@ -414,7 +414,7 @@ references t(a,b)
|
|
|
|
,s
|
|
|
|
,s
|
|
|
|
"create table t (a int references u on update cascade );"
|
|
|
|
"create table t (a int references u on update cascade );"
|
|
|
|
$ CreateTable [Name Nothing "t"]
|
|
|
|
$ CreateTable [Name Nothing "t"]
|
|
|
|
[TableColumnDef $ ColumnDef (Name Nothing "a") (Just (TypeName [Name Nothing "int"])) Nothing
|
|
|
|
[TableColumnDef $ ColumnDef (Name Nothing "a") (Just (TypeName [Name Nothing "int"]))
|
|
|
|
[ColConstraintDef Nothing $ ColReferencesConstraint
|
|
|
|
[ColConstraintDef Nothing $ ColReferencesConstraint
|
|
|
|
[Name Nothing "u"] Nothing DefaultReferenceMatch
|
|
|
|
[Name Nothing "u"] Nothing DefaultReferenceMatch
|
|
|
|
RefCascade DefaultReferentialAction]]
|
|
|
|
RefCascade DefaultReferentialAction]]
|
|
|
@ -423,7 +423,7 @@ references t(a,b)
|
|
|
|
,s
|
|
|
|
,s
|
|
|
|
"create table t (a int references u on update set null );"
|
|
|
|
"create table t (a int references u on update set null );"
|
|
|
|
$ CreateTable [Name Nothing "t"]
|
|
|
|
$ CreateTable [Name Nothing "t"]
|
|
|
|
[TableColumnDef $ ColumnDef (Name Nothing "a") (Just (TypeName [Name Nothing "int"])) Nothing
|
|
|
|
[TableColumnDef $ ColumnDef (Name Nothing "a") (Just (TypeName [Name Nothing "int"]))
|
|
|
|
[ColConstraintDef Nothing $ ColReferencesConstraint
|
|
|
|
[ColConstraintDef Nothing $ ColReferencesConstraint
|
|
|
|
[Name Nothing "u"] Nothing DefaultReferenceMatch
|
|
|
|
[Name Nothing "u"] Nothing DefaultReferenceMatch
|
|
|
|
RefSetNull DefaultReferentialAction]]
|
|
|
|
RefSetNull DefaultReferentialAction]]
|
|
|
@ -432,7 +432,7 @@ references t(a,b)
|
|
|
|
,s
|
|
|
|
,s
|
|
|
|
"create table t (a int references u on update set default );"
|
|
|
|
"create table t (a int references u on update set default );"
|
|
|
|
$ CreateTable [Name Nothing "t"]
|
|
|
|
$ CreateTable [Name Nothing "t"]
|
|
|
|
[TableColumnDef $ ColumnDef (Name Nothing "a") (Just (TypeName [Name Nothing "int"])) Nothing
|
|
|
|
[TableColumnDef $ ColumnDef (Name Nothing "a") (Just (TypeName [Name Nothing "int"]))
|
|
|
|
[ColConstraintDef Nothing $ ColReferencesConstraint
|
|
|
|
[ColConstraintDef Nothing $ ColReferencesConstraint
|
|
|
|
[Name Nothing "u"] Nothing DefaultReferenceMatch
|
|
|
|
[Name Nothing "u"] Nothing DefaultReferenceMatch
|
|
|
|
RefSetDefault DefaultReferentialAction]]
|
|
|
|
RefSetDefault DefaultReferentialAction]]
|
|
|
@ -441,7 +441,7 @@ references t(a,b)
|
|
|
|
,s
|
|
|
|
,s
|
|
|
|
"create table t (a int references u on update no action );"
|
|
|
|
"create table t (a int references u on update no action );"
|
|
|
|
$ CreateTable [Name Nothing "t"]
|
|
|
|
$ CreateTable [Name Nothing "t"]
|
|
|
|
[TableColumnDef $ ColumnDef (Name Nothing "a") (Just (TypeName [Name Nothing "int"])) Nothing
|
|
|
|
[TableColumnDef $ ColumnDef (Name Nothing "a") (Just (TypeName [Name Nothing "int"]))
|
|
|
|
[ColConstraintDef Nothing $ ColReferencesConstraint
|
|
|
|
[ColConstraintDef Nothing $ ColReferencesConstraint
|
|
|
|
[Name Nothing "u"] Nothing DefaultReferenceMatch
|
|
|
|
[Name Nothing "u"] Nothing DefaultReferenceMatch
|
|
|
|
RefNoAction DefaultReferentialAction]]
|
|
|
|
RefNoAction DefaultReferentialAction]]
|
|
|
@ -450,7 +450,7 @@ references t(a,b)
|
|
|
|
,s
|
|
|
|
,s
|
|
|
|
"create table t (a int references u on delete cascade );"
|
|
|
|
"create table t (a int references u on delete cascade );"
|
|
|
|
$ CreateTable [Name Nothing "t"]
|
|
|
|
$ CreateTable [Name Nothing "t"]
|
|
|
|
[TableColumnDef $ ColumnDef (Name Nothing "a") (Just (TypeName [Name Nothing "int"])) Nothing
|
|
|
|
[TableColumnDef $ ColumnDef (Name Nothing "a") (Just (TypeName [Name Nothing "int"]))
|
|
|
|
[ColConstraintDef Nothing $ ColReferencesConstraint
|
|
|
|
[ColConstraintDef Nothing $ ColReferencesConstraint
|
|
|
|
[Name Nothing "u"] Nothing DefaultReferenceMatch
|
|
|
|
[Name Nothing "u"] Nothing DefaultReferenceMatch
|
|
|
|
DefaultReferentialAction RefCascade]]
|
|
|
|
DefaultReferentialAction RefCascade]]
|
|
|
@ -460,7 +460,7 @@ references t(a,b)
|
|
|
|
,s
|
|
|
|
,s
|
|
|
|
"create table t (a int references u on update cascade on delete restrict );"
|
|
|
|
"create table t (a int references u on update cascade on delete restrict );"
|
|
|
|
$ CreateTable [Name Nothing "t"]
|
|
|
|
$ CreateTable [Name Nothing "t"]
|
|
|
|
[TableColumnDef $ ColumnDef (Name Nothing "a") (Just (TypeName [Name Nothing "int"])) Nothing
|
|
|
|
[TableColumnDef $ ColumnDef (Name Nothing "a") (Just (TypeName [Name Nothing "int"]))
|
|
|
|
[ColConstraintDef Nothing $ ColReferencesConstraint
|
|
|
|
[ColConstraintDef Nothing $ ColReferencesConstraint
|
|
|
|
[Name Nothing "u"] Nothing DefaultReferenceMatch
|
|
|
|
[Name Nothing "u"] Nothing DefaultReferenceMatch
|
|
|
|
RefCascade RefRestrict]]
|
|
|
|
RefCascade RefRestrict]]
|
|
|
@ -469,7 +469,7 @@ references t(a,b)
|
|
|
|
,s
|
|
|
|
,s
|
|
|
|
"create table t (a int references u on delete restrict on update cascade );"
|
|
|
|
"create table t (a int references u on delete restrict on update cascade );"
|
|
|
|
$ CreateTable [Name Nothing "t"]
|
|
|
|
$ CreateTable [Name Nothing "t"]
|
|
|
|
[TableColumnDef $ ColumnDef (Name Nothing "a") (Just (TypeName [Name Nothing "int"])) Nothing
|
|
|
|
[TableColumnDef $ ColumnDef (Name Nothing "a") (Just (TypeName [Name Nothing "int"]))
|
|
|
|
[ColConstraintDef Nothing $ ColReferencesConstraint
|
|
|
|
[ColConstraintDef Nothing $ ColReferencesConstraint
|
|
|
|
[Name Nothing "u"] Nothing DefaultReferenceMatch
|
|
|
|
[Name Nothing "u"] Nothing DefaultReferenceMatch
|
|
|
|
RefCascade RefRestrict]]
|
|
|
|
RefCascade RefRestrict]]
|
|
|
@ -484,7 +484,7 @@ options
|
|
|
|
,s
|
|
|
|
,s
|
|
|
|
"create table t (a int check (a>5));"
|
|
|
|
"create table t (a int check (a>5));"
|
|
|
|
$ CreateTable [Name Nothing "t"]
|
|
|
|
$ CreateTable [Name Nothing "t"]
|
|
|
|
[TableColumnDef $ ColumnDef (Name Nothing "a") (Just (TypeName [Name Nothing "int"])) Nothing
|
|
|
|
[TableColumnDef $ ColumnDef (Name Nothing "a") (Just (TypeName [Name Nothing "int"]))
|
|
|
|
[ColConstraintDef Nothing
|
|
|
|
[ColConstraintDef Nothing
|
|
|
|
(ColCheckConstraint $ BinOp (Iden [Name Nothing "a"]) [Name Nothing ">"] (NumLit "5"))]]
|
|
|
|
(ColCheckConstraint $ BinOp (Iden [Name Nothing "a"]) [Name Nothing ">"] (NumLit "5"))]]
|
|
|
|
False
|
|
|
|
False
|
|
|
@ -502,13 +502,17 @@ options
|
|
|
|
,s "create table t (a int generated always as identity);"
|
|
|
|
,s "create table t (a int generated always as identity);"
|
|
|
|
$ CreateTable [Name Nothing "t"]
|
|
|
|
$ CreateTable [Name Nothing "t"]
|
|
|
|
[TableColumnDef $ ColumnDef (Name Nothing "a") (Just (TypeName [Name Nothing "int"]))
|
|
|
|
[TableColumnDef $ ColumnDef (Name Nothing "a") (Just (TypeName [Name Nothing "int"]))
|
|
|
|
(Just $ IdentityColumnSpec GeneratedAlways []) []]
|
|
|
|
[ColConstraintDef Nothing
|
|
|
|
|
|
|
|
$ ColDefaultClause
|
|
|
|
|
|
|
|
$ IdentityColumnSpec GeneratedAlways []]]
|
|
|
|
False
|
|
|
|
False
|
|
|
|
|
|
|
|
|
|
|
|
,s "create table t (a int generated by default as identity);"
|
|
|
|
,s "create table t (a int generated by default as identity);"
|
|
|
|
$ CreateTable [Name Nothing "t"]
|
|
|
|
$ CreateTable [Name Nothing "t"]
|
|
|
|
[TableColumnDef $ ColumnDef (Name Nothing "a") (Just (TypeName [Name Nothing "int"]))
|
|
|
|
[TableColumnDef $ ColumnDef (Name Nothing "a") (Just (TypeName [Name Nothing "int"]))
|
|
|
|
(Just $ IdentityColumnSpec GeneratedByDefault []) []]
|
|
|
|
[ColConstraintDef Nothing
|
|
|
|
|
|
|
|
$ ColDefaultClause
|
|
|
|
|
|
|
|
$ IdentityColumnSpec GeneratedByDefault []]]
|
|
|
|
False
|
|
|
|
False
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -517,12 +521,14 @@ options
|
|
|
|
\ ( start with 5 increment by 5 maxvalue 500 minvalue 5 cycle ));"
|
|
|
|
\ ( start with 5 increment by 5 maxvalue 500 minvalue 5 cycle ));"
|
|
|
|
$ CreateTable [Name Nothing "t"]
|
|
|
|
$ CreateTable [Name Nothing "t"]
|
|
|
|
[TableColumnDef $ ColumnDef (Name Nothing "a") (Just (TypeName [Name Nothing "int"]))
|
|
|
|
[TableColumnDef $ ColumnDef (Name Nothing "a") (Just (TypeName [Name Nothing "int"]))
|
|
|
|
(Just $ IdentityColumnSpec GeneratedAlways
|
|
|
|
[ColConstraintDef Nothing
|
|
|
|
[SGOStartWith 5
|
|
|
|
$ ColDefaultClause
|
|
|
|
,SGOIncrementBy 5
|
|
|
|
$ IdentityColumnSpec GeneratedAlways
|
|
|
|
,SGOMaxValue 500
|
|
|
|
[SGOStartWith 5
|
|
|
|
,SGOMinValue 5
|
|
|
|
,SGOIncrementBy 5
|
|
|
|
,SGOCycle]) []]
|
|
|
|
,SGOMaxValue 500
|
|
|
|
|
|
|
|
,SGOMinValue 5
|
|
|
|
|
|
|
|
,SGOCycle]]]
|
|
|
|
False
|
|
|
|
False
|
|
|
|
|
|
|
|
|
|
|
|
,s
|
|
|
|
,s
|
|
|
@ -530,11 +536,13 @@ options
|
|
|
|
\ ( start with -4 no maxvalue no minvalue no cycle ));"
|
|
|
|
\ ( start with -4 no maxvalue no minvalue no cycle ));"
|
|
|
|
$ CreateTable [Name Nothing "t"]
|
|
|
|
$ CreateTable [Name Nothing "t"]
|
|
|
|
[TableColumnDef $ ColumnDef (Name Nothing "a") (Just (TypeName [Name Nothing "int"]))
|
|
|
|
[TableColumnDef $ ColumnDef (Name Nothing "a") (Just (TypeName [Name Nothing "int"]))
|
|
|
|
(Just $ IdentityColumnSpec GeneratedAlways
|
|
|
|
[ColConstraintDef Nothing
|
|
|
|
[SGOStartWith (-4)
|
|
|
|
$ ColDefaultClause
|
|
|
|
,SGONoMaxValue
|
|
|
|
$ IdentityColumnSpec GeneratedAlways
|
|
|
|
,SGONoMinValue
|
|
|
|
[SGOStartWith (-4)
|
|
|
|
,SGONoCycle]) []]
|
|
|
|
,SGONoMaxValue
|
|
|
|
|
|
|
|
,SGONoMinValue
|
|
|
|
|
|
|
|
,SGONoCycle]]]
|
|
|
|
False
|
|
|
|
False
|
|
|
|
|
|
|
|
|
|
|
|
{-
|
|
|
|
{-
|
|
|
@ -560,10 +568,11 @@ generated always (valueexpr)
|
|
|
|
"create table t (a int, \n\
|
|
|
|
"create table t (a int, \n\
|
|
|
|
\ a2 int generated always as (a * 2));"
|
|
|
|
\ a2 int generated always as (a * 2));"
|
|
|
|
$ CreateTable [Name Nothing "t"]
|
|
|
|
$ CreateTable [Name Nothing "t"]
|
|
|
|
[TableColumnDef $ ColumnDef (Name Nothing "a") (Just (TypeName [Name Nothing "int"])) Nothing []
|
|
|
|
[TableColumnDef $ ColumnDef (Name Nothing "a") (Just (TypeName [Name Nothing "int"])) []
|
|
|
|
,TableColumnDef $ ColumnDef (Name Nothing "a2") (Just (TypeName [Name Nothing "int"]))
|
|
|
|
,TableColumnDef $ ColumnDef (Name Nothing "a2") (Just (TypeName [Name Nothing "int"]))
|
|
|
|
(Just $ GenerationClause
|
|
|
|
[ColConstraintDef Nothing
|
|
|
|
(BinOp (Iden [Name Nothing "a"]) [Name Nothing "*"] (NumLit "2"))) []]
|
|
|
|
$ ColDefaultClause
|
|
|
|
|
|
|
|
$ GenerationClause (BinOp (Iden [Name Nothing "a"]) [Name Nothing "*"] (NumLit "2"))]]
|
|
|
|
False
|
|
|
|
False
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -592,7 +601,9 @@ generated always (valueexpr)
|
|
|
|
,s "create table t (a int default 0);"
|
|
|
|
,s "create table t (a int default 0);"
|
|
|
|
$ CreateTable [Name Nothing "t"]
|
|
|
|
$ CreateTable [Name Nothing "t"]
|
|
|
|
[TableColumnDef $ ColumnDef (Name Nothing "a") (Just (TypeName [Name Nothing "int"]))
|
|
|
|
[TableColumnDef $ ColumnDef (Name Nothing "a") (Just (TypeName [Name Nothing "int"]))
|
|
|
|
(Just $ DefaultClause $ NumLit "0") []]
|
|
|
|
[ColConstraintDef Nothing
|
|
|
|
|
|
|
|
$ ColDefaultClause
|
|
|
|
|
|
|
|
$ DefaultClause $ NumLit "0"]]
|
|
|
|
False
|
|
|
|
False
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -627,7 +638,7 @@ generated always (valueexpr)
|
|
|
|
,s
|
|
|
|
,s
|
|
|
|
"create table t (a int, unique (a));"
|
|
|
|
"create table t (a int, unique (a));"
|
|
|
|
$ CreateTable [Name Nothing "t"]
|
|
|
|
$ CreateTable [Name Nothing "t"]
|
|
|
|
[TableColumnDef $ ColumnDef (Name Nothing "a") (Just (TypeName [Name Nothing "int"])) Nothing []
|
|
|
|
[TableColumnDef $ ColumnDef (Name Nothing "a") (Just (TypeName [Name Nothing "int"])) []
|
|
|
|
,TableConstraintDef Nothing $ TableUniqueConstraint [Name Nothing "a"]
|
|
|
|
,TableConstraintDef Nothing $ TableUniqueConstraint [Name Nothing "a"]
|
|
|
|
]
|
|
|
|
]
|
|
|
|
False
|
|
|
|
False
|
|
|
@ -635,7 +646,7 @@ generated always (valueexpr)
|
|
|
|
,s
|
|
|
|
,s
|
|
|
|
"create table t (a int, constraint a_unique unique (a));"
|
|
|
|
"create table t (a int, constraint a_unique unique (a));"
|
|
|
|
$ CreateTable [Name Nothing "t"]
|
|
|
|
$ CreateTable [Name Nothing "t"]
|
|
|
|
[TableColumnDef $ ColumnDef (Name Nothing "a") (Just (TypeName [Name Nothing "int"])) Nothing []
|
|
|
|
[TableColumnDef $ ColumnDef (Name Nothing "a") (Just (TypeName [Name Nothing "int"])) []
|
|
|
|
,TableConstraintDef (Just [Name Nothing "a_unique"]) $
|
|
|
|
,TableConstraintDef (Just [Name Nothing "a_unique"]) $
|
|
|
|
TableUniqueConstraint [Name Nothing "a"]
|
|
|
|
TableUniqueConstraint [Name Nothing "a"]
|
|
|
|
]
|
|
|
|
]
|
|
|
@ -646,8 +657,8 @@ generated always (valueexpr)
|
|
|
|
,s
|
|
|
|
,s
|
|
|
|
"create table t (a int, b int, unique (a,b));"
|
|
|
|
"create table t (a int, b int, unique (a,b));"
|
|
|
|
$ CreateTable [Name Nothing "t"]
|
|
|
|
$ CreateTable [Name Nothing "t"]
|
|
|
|
[TableColumnDef $ ColumnDef (Name Nothing "a") (Just (TypeName [Name Nothing "int"])) Nothing []
|
|
|
|
[TableColumnDef $ ColumnDef (Name Nothing "a") (Just (TypeName [Name Nothing "int"])) []
|
|
|
|
,TableColumnDef $ ColumnDef (Name Nothing "b") (Just (TypeName [Name Nothing "int"])) Nothing []
|
|
|
|
,TableColumnDef $ ColumnDef (Name Nothing "b") (Just (TypeName [Name Nothing "int"])) []
|
|
|
|
,TableConstraintDef Nothing $
|
|
|
|
,TableConstraintDef Nothing $
|
|
|
|
TableUniqueConstraint [Name Nothing "a", Name Nothing "b"]
|
|
|
|
TableUniqueConstraint [Name Nothing "a", Name Nothing "b"]
|
|
|
|
]
|
|
|
|
]
|
|
|
@ -656,8 +667,8 @@ generated always (valueexpr)
|
|
|
|
,s
|
|
|
|
,s
|
|
|
|
"create table t (a int, b int, primary key (a,b));"
|
|
|
|
"create table t (a int, b int, primary key (a,b));"
|
|
|
|
$ CreateTable [Name Nothing "t"]
|
|
|
|
$ CreateTable [Name Nothing "t"]
|
|
|
|
[TableColumnDef $ ColumnDef (Name Nothing "a") (Just (TypeName [Name Nothing "int"])) Nothing []
|
|
|
|
[TableColumnDef $ ColumnDef (Name Nothing "a") (Just (TypeName [Name Nothing "int"])) []
|
|
|
|
,TableColumnDef $ ColumnDef (Name Nothing "b") (Just (TypeName [Name Nothing "int"])) Nothing []
|
|
|
|
,TableColumnDef $ ColumnDef (Name Nothing "b") (Just (TypeName [Name Nothing "int"])) []
|
|
|
|
,TableConstraintDef Nothing $
|
|
|
|
,TableConstraintDef Nothing $
|
|
|
|
TablePrimaryKeyConstraint [Name Nothing "a", Name Nothing "b"]
|
|
|
|
TablePrimaryKeyConstraint [Name Nothing "a", Name Nothing "b"]
|
|
|
|
]
|
|
|
|
]
|
|
|
@ -684,8 +695,8 @@ defintely skip
|
|
|
|
"create table t (a int, b int,\n\
|
|
|
|
"create table t (a int, b int,\n\
|
|
|
|
\ foreign key (a,b) references u(c,d) match full on update cascade on delete restrict );"
|
|
|
|
\ foreign key (a,b) references u(c,d) match full on update cascade on delete restrict );"
|
|
|
|
$ CreateTable [Name Nothing "t"]
|
|
|
|
$ CreateTable [Name Nothing "t"]
|
|
|
|
[TableColumnDef $ ColumnDef (Name Nothing "a") (Just (TypeName [Name Nothing "int"])) Nothing []
|
|
|
|
[TableColumnDef $ ColumnDef (Name Nothing "a") (Just (TypeName [Name Nothing "int"])) []
|
|
|
|
,TableColumnDef $ ColumnDef (Name Nothing "b") (Just (TypeName [Name Nothing "int"])) Nothing []
|
|
|
|
,TableColumnDef $ ColumnDef (Name Nothing "b") (Just (TypeName [Name Nothing "int"])) []
|
|
|
|
,TableConstraintDef Nothing $
|
|
|
|
,TableConstraintDef Nothing $
|
|
|
|
TableReferencesConstraint
|
|
|
|
TableReferencesConstraint
|
|
|
|
[Name Nothing "a", Name Nothing "b"]
|
|
|
|
[Name Nothing "a", Name Nothing "b"]
|
|
|
@ -699,7 +710,7 @@ defintely skip
|
|
|
|
"create table t (a int,\n\
|
|
|
|
"create table t (a int,\n\
|
|
|
|
\ constraint tfku1 foreign key (a) references u);"
|
|
|
|
\ constraint tfku1 foreign key (a) references u);"
|
|
|
|
$ CreateTable [Name Nothing "t"]
|
|
|
|
$ CreateTable [Name Nothing "t"]
|
|
|
|
[TableColumnDef $ ColumnDef (Name Nothing "a") (Just (TypeName [Name Nothing "int"])) Nothing []
|
|
|
|
[TableColumnDef $ ColumnDef (Name Nothing "a") (Just (TypeName [Name Nothing "int"])) []
|
|
|
|
,TableConstraintDef (Just [Name Nothing "tfku1"]) $
|
|
|
|
,TableConstraintDef (Just [Name Nothing "tfku1"]) $
|
|
|
|
TableReferencesConstraint
|
|
|
|
TableReferencesConstraint
|
|
|
|
[Name Nothing "a"]
|
|
|
|
[Name Nothing "a"]
|
|
|
@ -714,8 +725,8 @@ defintely skip
|
|
|
|
\ foreign key (a) references u(c)\n\
|
|
|
|
\ foreign key (a) references u(c)\n\
|
|
|
|
\ foreign key (b) references v(d));"
|
|
|
|
\ foreign key (b) references v(d));"
|
|
|
|
$ CreateTable [Name Nothing "t"]
|
|
|
|
$ CreateTable [Name Nothing "t"]
|
|
|
|
[TableColumnDef $ ColumnDef (Name Nothing "a") (Just (TypeName [Name Nothing "int"])) Nothing []
|
|
|
|
[TableColumnDef $ ColumnDef (Name Nothing "a") (Just (TypeName [Name Nothing "int"])) []
|
|
|
|
,TableColumnDef $ ColumnDef (Name Nothing "b") (Just (TypeName [Name Nothing "int"])) Nothing []
|
|
|
|
,TableColumnDef $ ColumnDef (Name Nothing "b") (Just (TypeName [Name Nothing "int"])) []
|
|
|
|
,TableConstraintDef Nothing $
|
|
|
|
,TableConstraintDef Nothing $
|
|
|
|
TableReferencesConstraint
|
|
|
|
TableReferencesConstraint
|
|
|
|
[Name Nothing "a"]
|
|
|
|
[Name Nothing "a"]
|
|
|
@ -735,15 +746,35 @@ defintely skip
|
|
|
|
,testStatement ansi2011{ diWithoutRowidTables = True }
|
|
|
|
,testStatement ansi2011{ diWithoutRowidTables = True }
|
|
|
|
"create table t (a int) without rowid;"
|
|
|
|
"create table t (a int) without rowid;"
|
|
|
|
$ CreateTable [Name Nothing "t"]
|
|
|
|
$ CreateTable [Name Nothing "t"]
|
|
|
|
[TableColumnDef $ ColumnDef (Name Nothing "a") (Just (TypeName [Name Nothing "int"])) Nothing []]
|
|
|
|
[TableColumnDef $ ColumnDef (Name Nothing "a") (Just (TypeName [Name Nothing "int"])) []]
|
|
|
|
True
|
|
|
|
True
|
|
|
|
,testStatement ansi2011{ diOptionalColumnTypes = True }
|
|
|
|
,testStatement ansi2011{ diOptionalColumnTypes = True }
|
|
|
|
"create table t (a,b);"
|
|
|
|
"create table t (a,b);"
|
|
|
|
$ CreateTable [Name Nothing "t"]
|
|
|
|
$ CreateTable [Name Nothing "t"]
|
|
|
|
[TableColumnDef $ ColumnDef (Name Nothing "a") Nothing Nothing []
|
|
|
|
[TableColumnDef $ ColumnDef (Name Nothing "a") Nothing []
|
|
|
|
,TableColumnDef $ ColumnDef (Name Nothing "b") Nothing Nothing []
|
|
|
|
,TableColumnDef $ ColumnDef (Name Nothing "b") Nothing []
|
|
|
|
]
|
|
|
|
]
|
|
|
|
False
|
|
|
|
False
|
|
|
|
|
|
|
|
,testStatement ansi2011{ diDefaultClausesAsConstraints = True }
|
|
|
|
|
|
|
|
"create table t (a int default 1 default 2);"
|
|
|
|
|
|
|
|
$ CreateTable [Name Nothing "t"]
|
|
|
|
|
|
|
|
[TableColumnDef $ ColumnDef (Name Nothing "a") (Just (TypeName [Name Nothing "int"]))
|
|
|
|
|
|
|
|
[ColConstraintDef Nothing
|
|
|
|
|
|
|
|
$ ColDefaultClause
|
|
|
|
|
|
|
|
$ DefaultClause $ NumLit "1"
|
|
|
|
|
|
|
|
,ColConstraintDef Nothing
|
|
|
|
|
|
|
|
$ ColDefaultClause
|
|
|
|
|
|
|
|
$ DefaultClause $ NumLit "2"]]
|
|
|
|
|
|
|
|
False
|
|
|
|
|
|
|
|
,testStatement ansi2011{ diDefaultClausesAsConstraints = True }
|
|
|
|
|
|
|
|
"create table t (a int not null default 2);"
|
|
|
|
|
|
|
|
$ CreateTable [Name Nothing "t"]
|
|
|
|
|
|
|
|
[TableColumnDef $ ColumnDef (Name Nothing "a") (Just (TypeName [Name Nothing "int"]))
|
|
|
|
|
|
|
|
[ColConstraintDef Nothing ColNotNullConstraint
|
|
|
|
|
|
|
|
,ColConstraintDef Nothing
|
|
|
|
|
|
|
|
$ ColDefaultClause
|
|
|
|
|
|
|
|
$ DefaultClause $ NumLit "2"]]
|
|
|
|
|
|
|
|
False
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
{-
|
|
|
|
{-
|
|
|
@ -805,8 +836,8 @@ defintely skip
|
|
|
|
"create table t (a int, b int, \n\
|
|
|
|
"create table t (a int, b int, \n\
|
|
|
|
\ check (a > b));"
|
|
|
|
\ check (a > b));"
|
|
|
|
$ CreateTable [Name Nothing "t"]
|
|
|
|
$ CreateTable [Name Nothing "t"]
|
|
|
|
[TableColumnDef $ ColumnDef (Name Nothing "a") (Just (TypeName [Name Nothing "int"])) Nothing []
|
|
|
|
[TableColumnDef $ ColumnDef (Name Nothing "a") (Just (TypeName [Name Nothing "int"])) []
|
|
|
|
,TableColumnDef $ ColumnDef (Name Nothing "b") (Just (TypeName [Name Nothing "int"])) Nothing []
|
|
|
|
,TableColumnDef $ ColumnDef (Name Nothing "b") (Just (TypeName [Name Nothing "int"])) []
|
|
|
|
,TableConstraintDef Nothing $
|
|
|
|
,TableConstraintDef Nothing $
|
|
|
|
TableCheckConstraint
|
|
|
|
TableCheckConstraint
|
|
|
|
(BinOp (Iden [Name Nothing "a"]) [Name Nothing ">"] (Iden [Name Nothing "b"]))
|
|
|
|
(BinOp (Iden [Name Nothing "a"]) [Name Nothing ">"] (Iden [Name Nothing "b"]))
|
|
|
@ -818,8 +849,8 @@ defintely skip
|
|
|
|
"create table t (a int, b int, \n\
|
|
|
|
"create table t (a int, b int, \n\
|
|
|
|
\ constraint agtb check (a > b));"
|
|
|
|
\ constraint agtb check (a > b));"
|
|
|
|
$ CreateTable [Name Nothing "t"]
|
|
|
|
$ CreateTable [Name Nothing "t"]
|
|
|
|
[TableColumnDef $ ColumnDef (Name Nothing "a") (Just (TypeName [Name Nothing "int"])) Nothing []
|
|
|
|
[TableColumnDef $ ColumnDef (Name Nothing "a") (Just (TypeName [Name Nothing "int"])) []
|
|
|
|
,TableColumnDef $ ColumnDef (Name Nothing "b") (Just (TypeName [Name Nothing "int"])) Nothing []
|
|
|
|
,TableColumnDef $ ColumnDef (Name Nothing "b") (Just (TypeName [Name Nothing "int"])) []
|
|
|
|
,TableConstraintDef (Just [Name Nothing "agtb"]) $
|
|
|
|
,TableConstraintDef (Just [Name Nothing "agtb"]) $
|
|
|
|
TableCheckConstraint
|
|
|
|
TableCheckConstraint
|
|
|
|
(BinOp (Iden [Name Nothing "a"]) [Name Nothing ">"] (Iden [Name Nothing "b"]))
|
|
|
|
(BinOp (Iden [Name Nothing "a"]) [Name Nothing ">"] (Iden [Name Nothing "b"]))
|
|
|
@ -861,7 +892,7 @@ alter table t add a int unique not null check (a>0)
|
|
|
|
,s
|
|
|
|
,s
|
|
|
|
"alter table t add column a int"
|
|
|
|
"alter table t add column a int"
|
|
|
|
$ AlterTable [Name Nothing "t"] $ AddColumnDef
|
|
|
|
$ AlterTable [Name Nothing "t"] $ AddColumnDef
|
|
|
|
$ ColumnDef (Name Nothing "a") (Just (TypeName [Name Nothing "int"])) Nothing []
|
|
|
|
$ ColumnDef (Name Nothing "a") (Just (TypeName [Name Nothing "int"])) []
|
|
|
|
|
|
|
|
|
|
|
|
{-
|
|
|
|
{-
|
|
|
|
todo: more add column
|
|
|
|
todo: more add column
|
|
|
|