diff --git a/google/cloud/spanner_v1/param_types.py b/google/cloud/spanner_v1/param_types.py index 9b1910244d..3499c5b337 100644 --- a/google/cloud/spanner_v1/param_types.py +++ b/google/cloud/spanner_v1/param_types.py @@ -33,6 +33,7 @@ JSON = Type(code=TypeCode.JSON) PG_NUMERIC = Type(code=TypeCode.NUMERIC, type_annotation=TypeAnnotationCode.PG_NUMERIC) PG_JSONB = Type(code=TypeCode.JSON, type_annotation=TypeAnnotationCode.PG_JSONB) +PG_OID = Type(code=TypeCode.INT64, type_annotation=TypeAnnotationCode.PG_OID) def Array(element_type): diff --git a/tests/system/test_session_api.py b/tests/system/test_session_api.py index 6f1844faa9..5cba7441a4 100644 --- a/tests/system/test_session_api.py +++ b/tests/system/test_session_api.py @@ -2348,6 +2348,18 @@ def test_execute_sql_w_jsonb_bindings( ) +def test_execute_sql_w_oid_bindings( + not_emulator, not_google_standard_sql, sessions_database, database_dialect +): + _bind_test_helper( + sessions_database, + database_dialect, + spanner_v1.param_types.PG_OID, + 123, + [123, 456], + ) + + def test_execute_sql_w_query_param_struct(sessions_database, not_postgres): name = "Phred" count = 123 diff --git a/tests/unit/test_param_types.py b/tests/unit/test_param_types.py index 645774d79b..827f08658d 100644 --- a/tests/unit/test_param_types.py +++ b/tests/unit/test_param_types.py @@ -70,3 +70,20 @@ def test_it(self): found = param_types.PG_JSONB self.assertEqual(found, expected) + + +class Test_OidParamType(unittest.TestCase): + def test_it(self): + from google.cloud.spanner_v1 import Type + from google.cloud.spanner_v1 import TypeCode + from google.cloud.spanner_v1 import TypeAnnotationCode + from google.cloud.spanner_v1 import param_types + + expected = Type( + code=TypeCode.INT64, + type_annotation=TypeAnnotationCode.PG_OID, + ) + + found = param_types.PG_OID + + self.assertEqual(found, expected)