mirror of
https://github.com/psycopg/psycopg2.git
synced 2024-11-25 10:23:43 +03:00
test: add test to verify register_range() with names requiring escape
Unlike for register_composite(), this works already.
This commit is contained in:
parent
ac25d3bdc0
commit
7054e1aadf
|
@ -1660,6 +1660,22 @@ class RangeCasterTestCase(ConnectingTestCase):
|
|||
ra3 = register_range('r3', 'r3', cur2)
|
||||
self.assertEqual(ra3.typecaster.values[0], rars3.typecaster.values[0])
|
||||
|
||||
@skip_if_no_composite
|
||||
def test_rang_weird_name(self):
|
||||
cur = self.conn.cursor()
|
||||
cur.execute("""
|
||||
select nspname from pg_namespace
|
||||
where nspname = 'qux.quux';
|
||||
""")
|
||||
if not cur.fetchone():
|
||||
cur.execute('create schema "qux.quux";')
|
||||
|
||||
cur.execute('create type "qux.quux"."foo.range" as range (subtype=text)')
|
||||
r = psycopg2.extras.register_range(
|
||||
'"qux.quux"."foo.range"', "foorange", cur)
|
||||
cur.execute('''select '[a,z]'::"qux.quux"."foo.range"''')
|
||||
self.assertEqual(cur.fetchone()[0], r.range('a', 'z', '[]'))
|
||||
|
||||
|
||||
def test_suite():
|
||||
return unittest.TestLoader().loadTestsFromName(__name__)
|
||||
|
|
Loading…
Reference in New Issue
Block a user