diff options
author | Federico Caselli <cfederico87@gmail.com> | 2020-08-07 22:38:24 +0200 |
---|---|---|
committer | Federico Caselli <cfederico87@gmail.com> | 2020-08-18 22:03:28 +0000 |
commit | 8e01a928d9559014413d08855c187b563c35ae72 (patch) | |
tree | b3ba77209c098aa5da8cd18cb95a64c85f5198f0 /test/dialect/postgresql/test_compiler.py | |
parent | 0901190bb440580f0664fe3f6310173762b908e0 (diff) | |
download | sqlalchemy-8e01a928d9559014413d08855c187b563c35ae72.tar.gz |
Support data types for CREATE SEQUENCE in PostgreSQL
Allow specifying the data type when creating a :class:`.Sequence` in
PostgreSQL by using the parameter :paramref:`.Sequence.data_type`.
Fixes: #5498
Change-Id: I2b4a80aa89b1503c56748dc3ecd2cf145faddd8b
Diffstat (limited to 'test/dialect/postgresql/test_compiler.py')
-rw-r--r-- | test/dialect/postgresql/test_compiler.py | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/test/dialect/postgresql/test_compiler.py b/test/dialect/postgresql/test_compiler.py index ce285007f..708dbe147 100644 --- a/test/dialect/postgresql/test_compiler.py +++ b/test/dialect/postgresql/test_compiler.py @@ -1,6 +1,7 @@ # coding: utf-8 from sqlalchemy import and_ +from sqlalchemy import BigInteger from sqlalchemy import cast from sqlalchemy import Column from sqlalchemy import Computed @@ -15,6 +16,7 @@ from sqlalchemy import null from sqlalchemy import schema from sqlalchemy import select from sqlalchemy import Sequence +from sqlalchemy import SmallInteger from sqlalchemy import String from sqlalchemy import Table from sqlalchemy import testing @@ -92,6 +94,20 @@ class SequenceTest(fixtures.TestBase, AssertsCompiledSQL): r = conn.execute(t.insert()) eq_(r.inserted_primary_key, (1,)) + @testing.combinations( + (None, ""), + (Integer, "AS INTEGER "), + (SmallInteger, "AS SMALLINT "), + (BigInteger, "AS BIGINT "), + ) + def test_create_index_concurrently(self, type_, text): + s = Sequence("s1", data_type=type_) + self.assert_compile( + schema.CreateSequence(s), + "CREATE SEQUENCE s1 %sSTART WITH 1" % text, + dialect=postgresql.dialect(), + ) + class CompileTest(fixtures.TestBase, AssertsCompiledSQL): |