summaryrefslogtreecommitdiff
path: root/test/dialect/postgres.py
diff options
context:
space:
mode:
authorJason Kirtland <jek@discorporate.us>2007-08-22 07:33:03 +0000
committerJason Kirtland <jek@discorporate.us>2007-08-22 07:33:03 +0000
commitf981981235d512d892c1619cc6f7561ac3461d2e (patch)
treea3cf531e16a40ca6f4fb1493b36a2bcba38a11ec /test/dialect/postgres.py
parentd8f2ca2dc908f1396ce6695dc07ae0a3f3de4c6d (diff)
downloadsqlalchemy-f981981235d512d892c1619cc6f7561ac3461d2e.tar.gz
Added a test for the SELECT DISTINCT ON postgresqlism.
Test currently fails due to two problems in postgres.py, but I'm leaving it uncorrected for now as its not clear what the original intent was for lists.
Diffstat (limited to 'test/dialect/postgres.py')
-rw-r--r--test/dialect/postgres.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/test/dialect/postgres.py b/test/dialect/postgres.py
index 221f7660a..c12115c9a 100644
--- a/test/dialect/postgres.py
+++ b/test/dialect/postgres.py
@@ -115,6 +115,24 @@ class MiscTest(AssertMixin):
t.drop(checkfirst=True)
@testing.supported('postgres')
+ def test_distinct_on(self):
+ t = Table('mytable', MetaData(testbase.db),
+ Column('id', Integer, primary_key=True),
+ Column('a', String(8)))
+ self.assertEquals(
+ str(t.select(distinct=t.c.a)),
+ 'SELECT DISTINCT ON (mytable.a) mytable.id, mytable.a \n'
+ 'FROM mytable')
+ self.assertEquals(
+ str(t.select(distinct=['id','a'])),
+ 'SELECT DISTINCT ON (id, a) mytable.id, mytable.a \n'
+ 'FROM mytable')
+ self.assertEquals(
+ str(t.select(distinct=[t.c.id, t.c.a])),
+ 'SELECT DISTINCT ON (mytable.id, mytable.a) mytable.id, mytable.a \n'
+ 'FROM mytable')
+
+ @testing.supported('postgres')
def test_schema_reflection(self):
"""note: this test requires that the 'alt_schema' schema be separate and accessible by the test user"""