summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2023-02-14 12:45:24 -0500
committerMike Bayer <mike_mp@zzzcomputing.com>2023-02-15 13:17:48 -0500
commit8d97de0ba7ee8dbff4301be6a2bd76a963327d0f (patch)
treeb31644ac5f050dd7a4bda55c176269a582ecfce3 /tests
parenta79ba7d74d12e0be63e1afb05e037d0a052b5086 (diff)
downloadalembic-8d97de0ba7ee8dbff4301be6a2bd76a963327d0f.tar.gz
collapse all chars for mssql defaults, move quoting
Ongoing fixes for SQL Server server default comparisons under autogenerate, adjusting for SQL Server's collapsing of whitespace between SQL function arguments when reporting on a function-based server default, as well as its arbitrary addition of parenthesis within arguments; the approach has now been made more aggressive by stripping the two default strings to compare of all whitespace, parenthesis, and quoting characters. Fixed PostgreSQL server default comparison to handle SQL expressions sent as ``text()`` constructs, such as ``text("substring('name', 1, 3)")``, which previously would raise errors when attempting to run a server-based comparison. Change-Id: Icd861f62653fc7b3900164c0d047821125e1305e Fixes: #1177
Diffstat (limited to 'tests')
-rw-r--r--tests/test_autogen_diffs.py32
1 files changed, 32 insertions, 0 deletions
diff --git a/tests/test_autogen_diffs.py b/tests/test_autogen_diffs.py
index aa775d7..70ea10a 100644
--- a/tests/test_autogen_diffs.py
+++ b/tests/test_autogen_diffs.py
@@ -11,6 +11,7 @@ from sqlalchemy import Enum
from sqlalchemy import FLOAT
from sqlalchemy import ForeignKey
from sqlalchemy import ForeignKeyConstraint
+from sqlalchemy import func
from sqlalchemy import Index
from sqlalchemy import inspect
from sqlalchemy import INTEGER
@@ -913,6 +914,37 @@ class CompareServerDefaultTest(TestBase):
(VARCHAR(30), "some default"),
(VARCHAR(30), text("'//slash'")),
(VARCHAR(30), text("'has '' quote'")),
+ (
+ VARCHAR(30),
+ func.substring("name", 1, 3),
+ testing.exclusions.only_on(["mssql", "postgresql"]),
+ ), # note no space
+ (
+ VARCHAR(30),
+ text("substring('name',1,3)"),
+ testing.exclusions.only_on(["mssql", "postgresql"]),
+ ), # note no space
+ (
+ VARCHAR(30),
+ text("substring('name', 1, 3)"),
+ testing.exclusions.only_on(["mssql", "postgresql"]),
+ ), # note spaces
+ (
+ VARCHAR(50),
+ text(
+ "substring(user_name()," # note no space
+ "charindex('',user_name())+(1),len(user_name()))"
+ ),
+ testing.exclusions.only_on("mssql"),
+ ),
+ (
+ VARCHAR(50),
+ text(
+ "substring(user_name(), " # note space
+ "charindex('',user_name())+(1),len(user_name()))"
+ ),
+ testing.exclusions.only_on("mssql"),
+ ),
(DateTime(), text("(getdate())"), testing.exclusions.only_on("mssql")),
(
DateTime(),