mirror of
https://github.com/rbock/sqlpp11.git
synced 2024-11-15 20:31:16 +08:00
Add support for "rationale" column type from pg_rational extension
This commit is contained in:
parent
57077cd32b
commit
3c344c0546
@ -50,10 +50,12 @@ ddlOperator = pp.Or(
|
|||||||
|
|
||||||
ddlBracedExpression = pp.Forward()
|
ddlBracedExpression = pp.Forward()
|
||||||
ddlFunctionCall = pp.Forward()
|
ddlFunctionCall = pp.Forward()
|
||||||
ddlCast = ddlString + "::" + ddlTerm
|
ddlCastEnd = "::" + ddlTerm
|
||||||
|
ddlCast = ddlString + ddlCastEnd
|
||||||
ddlExpression = pp.OneOrMore(
|
ddlExpression = pp.OneOrMore(
|
||||||
ddlBracedExpression
|
ddlBracedExpression
|
||||||
| ddlFunctionCall
|
| ddlFunctionCall
|
||||||
|
| ddlCastEnd
|
||||||
| ddlCast
|
| ddlCast
|
||||||
| ddlOperator
|
| ddlOperator
|
||||||
| ddlString
|
| ddlString
|
||||||
@ -128,6 +130,7 @@ ddlTextTypes = [
|
|||||||
"json", # PostgreSQL
|
"json", # PostgreSQL
|
||||||
"tinytext", # MYSQL
|
"tinytext", # MYSQL
|
||||||
"mediumtext", # MYSQL
|
"mediumtext", # MYSQL
|
||||||
|
"rational", # PostgreSQL pg_rationale extension
|
||||||
]
|
]
|
||||||
|
|
||||||
ddlText = pp.Or(
|
ddlText = pp.Or(
|
||||||
@ -366,6 +369,17 @@ def testConstraint():
|
|||||||
assert result.isConstraint
|
assert result.isConstraint
|
||||||
|
|
||||||
|
|
||||||
|
def testRational():
|
||||||
|
for text in [
|
||||||
|
"pos RATIONAL NOT NULL DEFAULT nextval('rational_seq')::integer",
|
||||||
|
]:
|
||||||
|
result = ddlColumn.parseString(text, parseAll=True)
|
||||||
|
column = result[0]
|
||||||
|
assert column.name == "pos"
|
||||||
|
assert column.type == "text"
|
||||||
|
assert column.notNull
|
||||||
|
|
||||||
|
|
||||||
def testTable():
|
def testTable():
|
||||||
text = """
|
text = """
|
||||||
CREATE TABLE "public"."dk" (
|
CREATE TABLE "public"."dk" (
|
||||||
@ -391,6 +405,7 @@ def testParser():
|
|||||||
testDateTime()
|
testDateTime()
|
||||||
testColumn()
|
testColumn()
|
||||||
testConstraint()
|
testConstraint()
|
||||||
|
testRational()
|
||||||
testTable()
|
testTable()
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user