| 1788 | ''') |
| 1789 | |
| 1790 | async def test_enum(self): |
| 1791 | await self.con.execute(''' |
| 1792 | CREATE TYPE enum_t AS ENUM ('abc', 'def', 'ghi'); |
| 1793 | CREATE TABLE tab ( |
| 1794 | a text, |
| 1795 | b enum_t |
| 1796 | ); |
| 1797 | INSERT INTO tab (a, b) VALUES ('foo', 'abc'); |
| 1798 | INSERT INTO tab (a, b) VALUES ('bar', 'def'); |
| 1799 | ''') |
| 1800 | |
| 1801 | try: |
| 1802 | for i in range(10): |
| 1803 | r = await self.con.fetch(''' |
| 1804 | SELECT a, b FROM tab ORDER BY b |
| 1805 | ''') |
| 1806 | |
| 1807 | self.assertEqual(r, [('foo', 'abc'), ('bar', 'def')]) |
| 1808 | |
| 1809 | finally: |
| 1810 | await self.con.execute(''' |
| 1811 | DROP TABLE tab; |
| 1812 | DROP TYPE enum_t; |
| 1813 | ''') |
| 1814 | |
| 1815 | async def test_unknown_type_text_fallback(self): |
| 1816 | await self.con.execute(r'CREATE EXTENSION citext') |