Allow column constraints in any order

This commit is contained in:
Peter J. Holzer 2022-09-08 12:06:14 +02:00
parent 2cd66bdf50
commit 2da6559fc2
2 changed files with 2 additions and 2 deletions

View File

@ -1,6 +1,6 @@
[metadata] [metadata]
name = ProcruSQL name = ProcruSQL
version = 0.0.7 version = 0.0.8
author = Peter J. Holzer author = Peter J. Holzer
author_email = hjp@hjp.at author_email = hjp@hjp.at
description = Make a database fit its description description = Make a database fit its description

View File

@ -291,7 +291,7 @@ def parse_column_definition(ps):
"text", "character varying", "text", "character varying",
"date", "timestamp with time zone", "timestamptz" "date", "timestamp with time zone", "timestamptz"
) )
pattern = "(" + "|".join(sqltypes) + ")" + r"([ \t]+default .*)?([ \t]+not null)?([ \t]+(primary key|unique|references \w+))?\b" pattern = "(" + "|".join(sqltypes) + ")" + r"([ \t]+(default .*|not null\b|primary key\b|unique\b|references \w+\b))*"
m = ps2.match(pattern) m = ps2.match(pattern)
if not m: if not m:
ps.record_child_failure(ps2, "expected column definition") ps.record_child_failure(ps2, "expected column definition")