Skip to content

Commit

Permalink
chore: remove tag restrictions in Connection API (#2970)
Browse files Browse the repository at this point in the history
The Connection API used a regex to limit the possible values that could
be set for statement and transaction tags. These limitations were not in
sync with what the actual allowed values for tags are in Spanner. The
restrictions in the Connection API have therefore been removed, and all
validation is done by the Spanner backend instead.
  • Loading branch information
olavloite authored Mar 26, 2024
1 parent 1eb3db9 commit a23d89f
Show file tree
Hide file tree
Showing 5 changed files with 10,284 additions and 9,818 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -449,11 +449,11 @@
"statementType": "SET_STATEMENT_TAG",
"regex": "(?is)\\A\\s*set\\s+statement_tag\\s*(?:=)\\s*(.*)\\z",
"method": "statementSetStatementTag",
"exampleStatements": ["set statement_tag='tag1'", "set statement_tag='tag2'", "set statement_tag=''"],
"exampleStatements": ["set statement_tag='tag1'", "set statement_tag='tag2'", "set statement_tag=''", "set statement_tag='test_tag'"],
"setStatement": {
"propertyName": "STATEMENT_TAG",
"separator": "=",
"allowedValues": "'(([a-zA-Z][a-zA-Z0-9_\\-]{1,63})|())'",
"allowedValues": "'(.*)'",
"converterName": "ClientSideStatementValueConverters$StringValueConverter"
}
},
Expand All @@ -464,12 +464,12 @@
"statementType": "SET_TRANSACTION_TAG",
"regex": "(?is)\\A\\s*set\\s+transaction_tag\\s*(?:=)\\s*(.*)\\z",
"method": "statementSetTransactionTag",
"exampleStatements": ["set transaction_tag='tag1'", "set transaction_tag='tag2'", "set transaction_tag=''"],
"exampleStatements": ["set transaction_tag='tag1'", "set transaction_tag='tag2'", "set transaction_tag=''", "set transaction_tag='test_tag'"],
"examplePrerequisiteStatements": ["set autocommit = false"],
"setStatement": {
"propertyName": "TRANSACTION_TAG",
"separator": "=",
"allowedValues": "'(([a-zA-Z][a-zA-Z0-9_\\-]{1,63})|())'",
"allowedValues": "'(.*)'",
"converterName": "ClientSideStatementValueConverters$StringValueConverter"
}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -621,12 +621,13 @@
"set spanner.statement_tag=''",
"set spanner.statement_tag to 'tag1'",
"set spanner.statement_tag to 'tag2'",
"set spanner.statement_tag to ''"
"set spanner.statement_tag to ''",
"set spanner.statement_tag to 'test_tag'"
],
"setStatement": {
"propertyName": "SPANNER.STATEMENT_TAG",
"separator": "(?:=|\\s+TO\\s+)",
"allowedValues": "'(([a-zA-Z][a-zA-Z0-9_\\-]{1,63})|())'",
"allowedValues": "'(.*)'",
"converterName": "ClientSideStatementValueConverters$StringValueConverter"
}
},
Expand All @@ -643,13 +644,14 @@
"set spanner.transaction_tag=''",
"set spanner.transaction_tag to 'tag1'",
"set spanner.transaction_tag to 'tag2'",
"set spanner.transaction_tag to ''"
"set spanner.transaction_tag to ''",
"set spanner.transaction_tag to 'test_tag'"
],
"examplePrerequisiteStatements": ["set autocommit = false"],
"setStatement": {
"propertyName": "SPANNER.TRANSACTION_TAG",
"separator": "(?:=|\\s+TO\\s+)",
"allowedValues": "'(([a-zA-Z][a-zA-Z0-9_\\-]{1,63})|())'",
"allowedValues": "'(.*)'",
"converterName": "ClientSideStatementValueConverters$StringValueConverter"
}
},
Expand Down
Loading

0 comments on commit a23d89f

Please sign in to comment.