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

Closed
zzzeek opened this Issue Mar 4, 2019 · 2 comments

Comments

Projects
None yet
2 participants
@zzzeek
Copy link
Member

zzzeek commented Mar 4, 2019

diff --git a/tests/test_postgresql.py b/tests/test_postgresql.py
index 73300f5..da945d8 100644
--- a/tests/test_postgresql.py
+++ b/tests/test_postgresql.py
@@ -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

This comment has been minimized.

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
)

print(rendered_metadata_default)

py36: '' py37: '''

@sqla-tester

This comment has been minimized.

Copy link
Collaborator

sqla-tester commented Mar 4, 2019

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

Clarify and correct PostgreSQL server default comparison for py37 https://gerrit.sqlalchemy.org/1150

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.