Restrict column and index definitions to one line
This commit is contained in:
parent
f71ce98af5
commit
2665e56e6f
|
@ -1,6 +1,6 @@
|
||||||
[metadata]
|
[metadata]
|
||||||
name = ProcruSQL
|
name = ProcruSQL
|
||||||
version = 0.0.5
|
version = 0.0.6
|
||||||
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
|
||||||
|
|
|
@ -209,7 +209,7 @@ def parse_index_rule(ps):
|
||||||
table_name = ps3.ast[0]
|
table_name = ps3.ast[0]
|
||||||
ps2.position = ps3.position
|
ps2.position = ps3.position
|
||||||
|
|
||||||
m = ps2.match(r"\s*(using\b|\([\w, ]+\))[^>]*")
|
m = ps2.match(r"\s*(using\b|\([\w, ]+\))[^>\n]*")
|
||||||
if not m:
|
if not m:
|
||||||
ps.record_child_failure(ps2, "expected “using” or column list")
|
ps.record_child_failure(ps2, "expected “using” or column list")
|
||||||
index_definition = m.group(0)
|
index_definition = m.group(0)
|
||||||
|
@ -282,7 +282,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"(\s+default .*)?(\s+not null)?(\s+(primary key|unique|references \w+))?\b"
|
pattern = "(" + "|".join(sqltypes) + ")" + r"([ \t]+default .*)?([ \t]+not null)?([ \t]+(primary key|unique|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")
|
||||||
|
|
Loading…
Reference in New Issue