Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

server default comparison for blank string fails for Postgresql / Py3.7 #541

zzzeek opened this issue Mar 4, 2019 · 2 comments


Copy link

zzzeek commented Mar 4, 2019

diff --git a/tests/ b/tests/
index 73300f5..da945d8 100644
--- a/tests/
+++ b/tests/
@@ -506,6 +506,9 @@ class PostgresqlDefaultCompareTest(TestBase):
             None, col, rendered, cols[0]["default"]
+    def test_compare_string_blank_default(self):
+        self._compare_default_roundtrip(String(8), '')
     def test_compare_interval_str(self):
         # this form shouldn't be used but testing here
         # for compatibility

in py37 we get:

psycopg2.ProgrammingError: unterminated quoted string at or near "'''"
LINE 1: SELECT ''::character varying = '''

in py36 no problem.

@zzzeek zzzeek added this to the fasttrack milestone Mar 4, 2019
Copy link
Member Author

zzzeek commented Mar 4, 2019

so it's a broken regex:

import re

rendered_metadata_default = "''"
rendered_metadata_default = re.sub(
    r"^u?'?|'?$", "'", rendered_metadata_default


py36: '' py37: '''

Copy link

Mike Bayer has proposed a fix for this issue in the master branch:

Clarify and correct PostgreSQL server default comparison for py37

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet

No branches or pull requests

2 participants