Compare commits

..

No commits in common. "f6c64a50abe37daf3e921fa9cdf23aac7aebee0e" and "6c3437a5f1e960a9e182604c734349ca45d85c18" have entirely different histories.

2 changed files with 10 additions and 15 deletions

View File

@ -1,6 +1,6 @@
[metadata] [metadata]
name = ProcruSQL name = ProcruSQL
version = 0.0.14 version = 0.0.12
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

@ -285,20 +285,15 @@ def parse_column_definition(ps):
ps2 = ps.clone() ps2 = ps.clone()
ps2.ast = [] ps2.ast = []
ps2.skip_whitespace_and_comments() ps2.skip_whitespace_and_comments()
sqltypes = sorted( sqltypes = (
( "integer", "int", "serial", "bigint",
"integer", "int", "serial", "bigint", "boolean",
"boolean", "text", "character varying",
"text", "character varying", "date", "timestamp with time zone", "timestamptz",
"date", "timestamp with time zone", "timestamptz", "time",
"time", "inet",
"inet", "double precision", "float8", "real", "float4",
"double precision", "float8", "real", "float4", "json", "jsonb",
"json", "jsonb",
"uuid",
r"integer\[\]", r"int\[\]", r"bigint\[\]",
),
key=lambda x: -len(x) # longest match first
) )
pattern = "(" + "|".join(sqltypes) + ")" + r"([ \t]+(default .*|not null\b|primary key\b|unique\b|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)