| 1742 | ''') |
| 1743 | |
| 1744 | async def test_enum(self): |
| 1745 | await self.con.execute(''' |
| 1746 | CREATE TYPE enum_t AS ENUM ('abc', 'def', 'ghi'); |
| 1747 | CREATE TABLE tab ( |
| 1748 | a text, |
| 1749 | b enum_t |
| 1750 | ); |
| 1751 | INSERT INTO tab (a, b) VALUES ('foo', 'abc'); |
| 1752 | INSERT INTO tab (a, b) VALUES ('bar', 'def'); |
| 1753 | ''') |
| 1754 | |
| 1755 | try: |
| 1756 | for i in range(10): |
| 1757 | r = await self.con.fetch(''' |
| 1758 | SELECT a, b FROM tab ORDER BY b |
| 1759 | ''') |
| 1760 | |
| 1761 | self.assertEqual(r, [('foo', 'abc'), ('bar', 'def')]) |
| 1762 | |
| 1763 | finally: |
| 1764 | await self.con.execute(''' |
| 1765 | DROP TABLE tab; |
| 1766 | DROP TYPE enum_t; |
| 1767 | ''') |
| 1768 | |
| 1769 | async def test_unknown_type_text_fallback(self): |
| 1770 | await self.con.execute(r'CREATE EXTENSION citext') |