Reference documentation and code samples for the Cloud Spanner V1 Client class 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.
Protobuf type google.spanner.v1.TypeAnnotationCode
Namespace
Google \ Cloud \ Spanner \ V1
Methods
static::name
Parameter
Name
Description
value
mixed
static::value
Parameter
Name
Description
name
mixed
Constants
TYPE_ANNOTATION_CODE_UNSPECIFIED
Value: 0
Not specified.
Generated from protobuf enum TYPE_ANNOTATION_CODE_UNSPECIFIED = 0;
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.
Generated from protobuf enum PG_NUMERIC = 2;
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.
Generated from protobuf enum PG_JSONB = 3;
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 Client - Class TypeAnnotationCode (1.104.0)\n\nVersion latestkeyboard_arrow_down\n\n- [1.104.0 (latest)](/php/docs/reference/cloud-spanner/latest/V1.TypeAnnotationCode)\n- [1.103.0](/php/docs/reference/cloud-spanner/1.103.0/V1.TypeAnnotationCode)\n- [1.102.0](/php/docs/reference/cloud-spanner/1.102.0/V1.TypeAnnotationCode)\n- [1.101.0](/php/docs/reference/cloud-spanner/1.101.0/V1.TypeAnnotationCode)\n- [1.100.0](/php/docs/reference/cloud-spanner/1.100.0/V1.TypeAnnotationCode)\n- [1.98.0](/php/docs/reference/cloud-spanner/1.98.0/V1.TypeAnnotationCode)\n- [1.97.0](/php/docs/reference/cloud-spanner/1.97.0/V1.TypeAnnotationCode)\n- [1.96.0](/php/docs/reference/cloud-spanner/1.96.0/V1.TypeAnnotationCode)\n- [1.95.0](/php/docs/reference/cloud-spanner/1.95.0/V1.TypeAnnotationCode)\n- [1.94.0](/php/docs/reference/cloud-spanner/1.94.0/V1.TypeAnnotationCode)\n- [1.93.1](/php/docs/reference/cloud-spanner/1.93.1/V1.TypeAnnotationCode)\n- [1.92.1](/php/docs/reference/cloud-spanner/1.92.1/V1.TypeAnnotationCode)\n- [1.91.0](/php/docs/reference/cloud-spanner/1.91.0/V1.TypeAnnotationCode)\n- [1.90.0](/php/docs/reference/cloud-spanner/1.90.0/V1.TypeAnnotationCode)\n- [1.89.0](/php/docs/reference/cloud-spanner/1.89.0/V1.TypeAnnotationCode)\n- [1.88.0](/php/docs/reference/cloud-spanner/1.88.0/V1.TypeAnnotationCode)\n- [1.87.0](/php/docs/reference/cloud-spanner/1.87.0/V1.TypeAnnotationCode)\n- [1.86.0](/php/docs/reference/cloud-spanner/1.86.0/V1.TypeAnnotationCode)\n- [1.85.0](/php/docs/reference/cloud-spanner/1.85.0/V1.TypeAnnotationCode)\n- [1.84.0](/php/docs/reference/cloud-spanner/1.84.0/V1.TypeAnnotationCode)\n- [1.83.0](/php/docs/reference/cloud-spanner/1.83.0/V1.TypeAnnotationCode)\n- [1.82.0](/php/docs/reference/cloud-spanner/1.82.0/V1.TypeAnnotationCode)\n- [1.81.0](/php/docs/reference/cloud-spanner/1.81.0/V1.TypeAnnotationCode)\n- [1.80.0](/php/docs/reference/cloud-spanner/1.80.0/V1.TypeAnnotationCode)\n- [1.79.0](/php/docs/reference/cloud-spanner/1.79.0/V1.TypeAnnotationCode)\n- [1.78.0](/php/docs/reference/cloud-spanner/1.78.0/V1.TypeAnnotationCode)\n- [1.77.0](/php/docs/reference/cloud-spanner/1.77.0/V1.TypeAnnotationCode)\n- [1.76.1](/php/docs/reference/cloud-spanner/1.76.1/V1.TypeAnnotationCode)\n- [1.68.0](/php/docs/reference/cloud-spanner/1.68.0/V1.TypeAnnotationCode)\n- [1.67.0](/php/docs/reference/cloud-spanner/1.67.0/V1.TypeAnnotationCode)\n- [1.66.0](/php/docs/reference/cloud-spanner/1.66.0/V1.TypeAnnotationCode)\n- [1.65.0](/php/docs/reference/cloud-spanner/1.65.0/V1.TypeAnnotationCode)\n- [1.64.0](/php/docs/reference/cloud-spanner/1.64.0/V1.TypeAnnotationCode)\n- [1.63.2](/php/docs/reference/cloud-spanner/1.63.2/V1.TypeAnnotationCode)\n- [1.62.1](/php/docs/reference/cloud-spanner/1.62.1/V1.TypeAnnotationCode)\n- [1.61.0](/php/docs/reference/cloud-spanner/1.61.0/V1.TypeAnnotationCode)\n- [1.60.0](/php/docs/reference/cloud-spanner/1.60.0/V1.TypeAnnotationCode)\n- [1.59.0](/php/docs/reference/cloud-spanner/1.59.0/V1.TypeAnnotationCode)\n- [1.58.4](/php/docs/reference/cloud-spanner/1.58.4/V1.TypeAnnotationCode)\n- [1.57.0](/php/docs/reference/cloud-spanner/1.57.0/V1.TypeAnnotationCode)\n- [1.56.0](/php/docs/reference/cloud-spanner/1.56.0/V1.TypeAnnotationCode)\n- [1.55.0](/php/docs/reference/cloud-spanner/1.55.0/V1.TypeAnnotationCode)\n- [1.54.2](/php/docs/reference/cloud-spanner/1.54.2/V1.TypeAnnotationCode) \nReference documentation and code samples for the Cloud Spanner V1 Client class TypeAnnotationCode.\n\n`TypeAnnotationCode` is used as a part of [Type](/php/docs/reference/cloud-spanner/latest/V1.Type) to\ndisambiguate SQL types that should be used for a given Cloud Spanner value.\n\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\nProtobuf type `google.spanner.v1.TypeAnnotationCode`\n\nNamespace\n---------\n\nGoogle \\\\ Cloud \\\\ Spanner \\\\ V1\n\nMethods\n-------\n\n### static::name\n\n### static::value\n\nConstants\n---------\n\n### TYPE_ANNOTATION_CODE_UNSPECIFIED\n\n Value: 0\n\nNot specified.\n\nGenerated from protobuf enum `TYPE_ANNOTATION_CODE_UNSPECIFIED = 0;`\n\n### PG_NUMERIC\n\n Value: 2\n\nPostgreSQL compatible NUMERIC type. This annotation needs to be applied to\n[Type](/php/docs/reference/cloud-spanner/latest/V1.Type) instances having\n[NUMERIC](/php/docs/reference/cloud-spanner/latest/V1.TypeCode#_Google_Cloud_Spanner_V1_TypeCode__NUMERIC) type code to specify that\nvalues of this type should be treated as PostgreSQL NUMERIC values.\n\nCurrently this annotation is always needed for\n[NUMERIC](/php/docs/reference/cloud-spanner/latest/V1.TypeCode#_Google_Cloud_Spanner_V1_TypeCode__NUMERIC) when a client interacts with\nPostgreSQL-enabled Spanner databases.\n\nGenerated from protobuf enum `PG_NUMERIC = 2;`\n\n### PG_JSONB\n\n Value: 3\n\nPostgreSQL compatible JSONB type. This annotation needs to be applied to\n[Type](/php/docs/reference/cloud-spanner/latest/V1.Type) instances having\n[JSON](/php/docs/reference/cloud-spanner/latest/V1.TypeCode#_Google_Cloud_Spanner_V1_TypeCode__JSON) type code to specify that values of\nthis type should be treated as PostgreSQL JSONB values. Currently this\nannotation is always needed for [JSON](/php/docs/reference/cloud-spanner/latest/V1.TypeCode#_Google_Cloud_Spanner_V1_TypeCode__JSON)\nwhen a client interacts with PostgreSQL-enabled Spanner databases.\n\nGenerated from protobuf enum `PG_JSONB = 3;`\n\n### PG_OID\n\n Value: 4\n\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.\n\nGenerated from protobuf enum `PG_OID = 4;`"]]