diff options
| author | mike bayer <mike_mp@zzzcomputing.com> | 2019-11-04 19:50:17 +0000 |
|---|---|---|
| committer | Gerrit Code Review <gerrit@bbpush.zzzcomputing.com> | 2019-11-04 19:50:17 +0000 |
| commit | 98f7c0c080ebbc8236fc0cc98970cb1b0112c01e (patch) | |
| tree | f119c0003461e0bd7426bb493391a1c563817bb4 /lib/sqlalchemy/dialects/postgresql/base.py | |
| parent | bee7c3462d6235b7e108dbdbcd0727cdcbc49eb0 (diff) | |
| parent | 29330ec1596f12462c501a65404ff52005b16b6c (diff) | |
| download | sqlalchemy-98f7c0c080ebbc8236fc0cc98970cb1b0112c01e.tar.gz | |
Merge "Add anonymizing context to cache keys, comparison; convert traversal"
Diffstat (limited to 'lib/sqlalchemy/dialects/postgresql/base.py')
| -rw-r--r-- | lib/sqlalchemy/dialects/postgresql/base.py | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/lib/sqlalchemy/dialects/postgresql/base.py b/lib/sqlalchemy/dialects/postgresql/base.py index 909d568a7..e94f9913c 100644 --- a/lib/sqlalchemy/dialects/postgresql/base.py +++ b/lib/sqlalchemy/dialects/postgresql/base.py @@ -1658,23 +1658,20 @@ class PGCompiler(compiler.SQLCompiler): return "ONLY " + sqltext def get_select_precolumns(self, select, **kw): - if select._distinct is not False: - if select._distinct is True: - return "DISTINCT " - elif isinstance(select._distinct, (list, tuple)): + if select._distinct or select._distinct_on: + if select._distinct_on: return ( "DISTINCT ON (" + ", ".join( - [self.process(col, **kw) for col in select._distinct] + [ + self.process(col, **kw) + for col in select._distinct_on + ] ) + ") " ) else: - return ( - "DISTINCT ON (" - + self.process(select._distinct, **kw) - + ") " - ) + return "DISTINCT " else: return "" |
