summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2022-06-08 19:04:23 -0400
committerMike Bayer <mike_mp@zzzcomputing.com>2022-06-08 19:04:23 -0400
commit409a2173ebe8a9126911051873b3734e6c6be3f4 (patch)
tree96d03ebd39794be07f5353bb854c6e37993f1030 /test
parentbf40bade26e32fc3757bbd756f4c9ebdc5d72090 (diff)
downloadsqlalchemy-409a2173ebe8a9126911051873b3734e6c6be3f4.tar.gz
add tests to confirm no issue w/ pg json keys
Change-Id: Ie91e5efb217c309bc40c3933f538bcf29c1fd87b References: #8112
Diffstat (limited to 'test')
-rw-r--r--test/dialect/postgresql/test_types.py27
1 files changed, 27 insertions, 0 deletions
diff --git a/test/dialect/postgresql/test_types.py b/test/dialect/postgresql/test_types.py
index ddb199aa4..266263d5f 100644
--- a/test/dialect/postgresql/test_types.py
+++ b/test/dialect/postgresql/test_types.py
@@ -3839,6 +3839,33 @@ class JSONRoundTripTest(fixtures.TablesTest):
).fetchall()
eq_([d for d, in data], [None])
+ @testing.combinations(
+ "key",
+ "réve🐍 illé",
+ 'name_with"quotes"name',
+ "name with spaces",
+ "name with ' single ' quotes",
+ 'some_key("idx")',
+ argnames="key",
+ )
+ def test_indexed_special_keys(self, connection, key):
+ data_table = self.tables.data_table
+ data_element = {key: "some value"}
+
+ connection.execute(
+ data_table.insert(),
+ {
+ "name": "row1",
+ "data": data_element,
+ "nulldata": data_element,
+ },
+ )
+
+ row = connection.execute(
+ select(data_table.c.data[key], data_table.c.nulldata[key])
+ ).one()
+ eq_(row, ("some value", "some value"))
+
def test_reflect(self, connection):
insp = inspect(connection)
cols = insp.get_columns("data_table")