xtern commented on code in PR #2683:
URL: https://github.com/apache/ignite-3/pull/2683#discussion_r1358261897
##########
modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/SqlQueryProcessor.java:
##########
@@ -559,11 +559,24 @@ public MetricManager metricManager() {
private static void validateParsedStatement(
QueryContext context,
ParsedResult parsedResult,
+ @Nullable InternalTransaction outerTx,
Object[] params
) {
Set<SqlQueryType> allowedTypes = context.allowedQueryTypes();
SqlQueryType queryType = parsedResult.queryType();
+ if (parsedResult.queryType() == SqlQueryType.TX_CONTROL) {
+ if (outerTx != null) {
Review Comment:
Checking for an explicit transaction seems useless, because the user is
currently prohibited from executing TX_CONTROL in any way. I suggest to make
this check in https://issues.apache.org/jira/browse/IGNITE-20463.
I'm not sure what the Script Processor will look like and I think this part
will change somehow in any case.
But instead of the current changes, what do you think about something like
this?
```
if (!allowedTypes.contains(queryType)) {
String message = parsedResult.queryType() ==
SqlQueryType.TX_CONTROL
? Transaction control statement can not be executed as
an independent statement"
: format("Invalid SQL statement type. Expected {} but
got {}", allowedTypes, queryType);
... old code
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]