Reference documentation and code samples for the Cloud Spanner V1 API module Google::Cloud::Spanner::V1::TypeAnnotationCode.
TypeAnnotationCode is used as a part of Type to
disambiguate SQL types that should be used for a given Cloud Spanner value.
Disambiguation is needed because the same Cloud Spanner type can be mapped to
different SQL types depending on SQL dialect. TypeAnnotationCode doesn't
affect the way value is serialized.
Constants
TYPE_ANNOTATION_CODE_UNSPECIFIED
value: 0 Not specified.
PG_NUMERIC
value: 2 PostgreSQL compatible NUMERIC type. This annotation needs to be applied to
Type instances having
NUMERIC type code to specify that
values of this type should be treated as PostgreSQL NUMERIC values.
Currently this annotation is always needed for
NUMERIC when a client interacts with
PostgreSQL-enabled Spanner databases.
PG_JSONB
value: 3 PostgreSQL compatible JSONB type. This annotation needs to be applied to
Type instances having
JSON type code to specify that values of
this type should be treated as PostgreSQL JSONB values. Currently this
annotation is always needed for JSON
when a client interacts with PostgreSQL-enabled Spanner databases.
PG_OID
value: 4 PostgreSQL compatible OID type. This annotation can be used by a client
interacting with PostgreSQL-enabled Spanner database to specify that a
value should be treated using the semantics of the OID type.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-28 UTC."],[],[],null,["# Cloud Spanner V1 API - Module Google::Cloud::Spanner::V1::TypeAnnotationCode (v1.10.0)\n\nVersion latestkeyboard_arrow_down\n\n- [1.10.0 (latest)](/ruby/docs/reference/google-cloud-spanner-v1/latest/Google-Cloud-Spanner-V1-TypeAnnotationCode)\n- [1.9.1](/ruby/docs/reference/google-cloud-spanner-v1/1.9.1/Google-Cloud-Spanner-V1-TypeAnnotationCode)\n- [1.8.0](/ruby/docs/reference/google-cloud-spanner-v1/1.8.0/Google-Cloud-Spanner-V1-TypeAnnotationCode)\n- [1.7.1](/ruby/docs/reference/google-cloud-spanner-v1/1.7.1/Google-Cloud-Spanner-V1-TypeAnnotationCode)\n- [1.6.0](/ruby/docs/reference/google-cloud-spanner-v1/1.6.0/Google-Cloud-Spanner-V1-TypeAnnotationCode)\n- [1.5.0](/ruby/docs/reference/google-cloud-spanner-v1/1.5.0/Google-Cloud-Spanner-V1-TypeAnnotationCode)\n- [1.4.0](/ruby/docs/reference/google-cloud-spanner-v1/1.4.0/Google-Cloud-Spanner-V1-TypeAnnotationCode)\n- [1.3.0](/ruby/docs/reference/google-cloud-spanner-v1/1.3.0/Google-Cloud-Spanner-V1-TypeAnnotationCode)\n- [1.2.0](/ruby/docs/reference/google-cloud-spanner-v1/1.2.0/Google-Cloud-Spanner-V1-TypeAnnotationCode)\n- [1.1.0](/ruby/docs/reference/google-cloud-spanner-v1/1.1.0/Google-Cloud-Spanner-V1-TypeAnnotationCode)\n- [1.0.2](/ruby/docs/reference/google-cloud-spanner-v1/1.0.2/Google-Cloud-Spanner-V1-TypeAnnotationCode)\n- [0.27.0](/ruby/docs/reference/google-cloud-spanner-v1/0.27.0/Google-Cloud-Spanner-V1-TypeAnnotationCode)\n- [0.26.0](/ruby/docs/reference/google-cloud-spanner-v1/0.26.0/Google-Cloud-Spanner-V1-TypeAnnotationCode)\n- [0.25.0](/ruby/docs/reference/google-cloud-spanner-v1/0.25.0/Google-Cloud-Spanner-V1-TypeAnnotationCode)\n- [0.24.0](/ruby/docs/reference/google-cloud-spanner-v1/0.24.0/Google-Cloud-Spanner-V1-TypeAnnotationCode)\n- [0.23.0](/ruby/docs/reference/google-cloud-spanner-v1/0.23.0/Google-Cloud-Spanner-V1-TypeAnnotationCode)\n- [0.22.2](/ruby/docs/reference/google-cloud-spanner-v1/0.22.2/Google-Cloud-Spanner-V1-TypeAnnotationCode)\n- [0.21.0](/ruby/docs/reference/google-cloud-spanner-v1/0.21.0/Google-Cloud-Spanner-V1-TypeAnnotationCode)\n- [0.20.1](/ruby/docs/reference/google-cloud-spanner-v1/0.20.1/Google-Cloud-Spanner-V1-TypeAnnotationCode)\n- [0.19.0](/ruby/docs/reference/google-cloud-spanner-v1/0.19.0/Google-Cloud-Spanner-V1-TypeAnnotationCode)\n- [0.18.0](/ruby/docs/reference/google-cloud-spanner-v1/0.18.0/Google-Cloud-Spanner-V1-TypeAnnotationCode)\n- [0.17.0](/ruby/docs/reference/google-cloud-spanner-v1/0.17.0/Google-Cloud-Spanner-V1-TypeAnnotationCode)\n- [0.16.0](/ruby/docs/reference/google-cloud-spanner-v1/0.16.0/Google-Cloud-Spanner-V1-TypeAnnotationCode)\n- [0.15.1](/ruby/docs/reference/google-cloud-spanner-v1/0.15.1/Google-Cloud-Spanner-V1-TypeAnnotationCode)\n- [0.14.1](/ruby/docs/reference/google-cloud-spanner-v1/0.14.1/Google-Cloud-Spanner-V1-TypeAnnotationCode)\n- [0.13.0](/ruby/docs/reference/google-cloud-spanner-v1/0.13.0/Google-Cloud-Spanner-V1-TypeAnnotationCode)\n- [0.12.0](/ruby/docs/reference/google-cloud-spanner-v1/0.12.0/Google-Cloud-Spanner-V1-TypeAnnotationCode)\n- [0.11.0](/ruby/docs/reference/google-cloud-spanner-v1/0.11.0/Google-Cloud-Spanner-V1-TypeAnnotationCode)\n- [0.10.0](/ruby/docs/reference/google-cloud-spanner-v1/0.10.0/Google-Cloud-Spanner-V1-TypeAnnotationCode)\n- [0.9.0](/ruby/docs/reference/google-cloud-spanner-v1/0.9.0/Google-Cloud-Spanner-V1-TypeAnnotationCode)\n- [0.8.1](/ruby/docs/reference/google-cloud-spanner-v1/0.8.1/Google-Cloud-Spanner-V1-TypeAnnotationCode)\n- [0.7.4](/ruby/docs/reference/google-cloud-spanner-v1/0.7.4/Google-Cloud-Spanner-V1-TypeAnnotationCode) \nReference documentation and code samples for the Cloud Spanner V1 API module Google::Cloud::Spanner::V1::TypeAnnotationCode.\n\n`TypeAnnotationCode` is used as a part of [Type](/ruby/docs/reference/google-cloud-spanner-v1/latest/Google-Cloud-Spanner-V1-Type \"Google::Cloud::Spanner::V1::Type (class)\") to\ndisambiguate SQL types that should be used for a given Cloud Spanner value.\nDisambiguation is needed because the same Cloud Spanner type can be mapped to\ndifferent SQL types depending on SQL dialect. TypeAnnotationCode doesn't\naffect the way value is serialized.\n\nConstants\n---------\n\n### TYPE_ANNOTATION_CODE_UNSPECIFIED\n\n**value:** 0 \nNot specified.\n\n### PG_NUMERIC\n\n**value:** 2 \nPostgreSQL compatible NUMERIC type. This annotation needs to be applied to\n[Type](/ruby/docs/reference/google-cloud-spanner-v1/latest/Google-Cloud-Spanner-V1-Type \"Google::Cloud::Spanner::V1::Type (class)\") instances having\n[NUMERIC](/ruby/docs/reference/google-cloud-spanner-v1/latest/Google-Cloud-Spanner-V1-TypeCode#Google__Cloud__Spanner__V1__TypeCode__NUMERIC \"Google::Cloud::Spanner::V1::TypeCode::NUMERIC (constant)\") type code to specify that\nvalues of this type should be treated as PostgreSQL NUMERIC values.\nCurrently this annotation is always needed for\n[NUMERIC](/ruby/docs/reference/google-cloud-spanner-v1/latest/Google-Cloud-Spanner-V1-TypeCode#Google__Cloud__Spanner__V1__TypeCode__NUMERIC \"Google::Cloud::Spanner::V1::TypeCode::NUMERIC (constant)\") when a client interacts with\nPostgreSQL-enabled Spanner databases.\n\n### PG_JSONB\n\n**value:** 3 \nPostgreSQL compatible JSONB type. This annotation needs to be applied to\n[Type](/ruby/docs/reference/google-cloud-spanner-v1/latest/Google-Cloud-Spanner-V1-Type \"Google::Cloud::Spanner::V1::Type (class)\") instances having\n[JSON](/ruby/docs/reference/google-cloud-spanner-v1/latest/Google-Cloud-Spanner-V1-TypeCode#Google__Cloud__Spanner__V1__TypeCode__JSON \"Google::Cloud::Spanner::V1::TypeCode::JSON (constant)\") type code to specify that values of\nthis type should be treated as PostgreSQL JSONB values. Currently this\nannotation is always needed for [JSON](/ruby/docs/reference/google-cloud-spanner-v1/latest/Google-Cloud-Spanner-V1-TypeCode#Google__Cloud__Spanner__V1__TypeCode__JSON \"Google::Cloud::Spanner::V1::TypeCode::JSON (constant)\")\nwhen a client interacts with PostgreSQL-enabled Spanner databases.\n\n### PG_OID\n\n**value:** 4 \nPostgreSQL compatible OID type. This annotation can be used by a client\ninteracting with PostgreSQL-enabled Spanner database to specify that a\nvalue should be treated using the semantics of the OID type."]]