alex-plekhanov commented on code in PR #12423:
URL: https://github.com/apache/ignite/pull/12423#discussion_r2432514847
##########
docs/_docs/SQL/schemas.adoc:
##########
@@ -92,3 +92,44 @@ If you do not use this parameter, the cache name is defined
in the following for
....
SQL_<SCHEMA_NAME>_<TABLE_NAME>
....
+
+
+== Validating Data Against the Schema
+
+Ignite can verify that values inserted into a table match the column types and
constraints declared in its SQL schema. Validation is disabled by default;
enable the server-side check on every node before startup:
Review Comment:
> Validation is disabled by default;
1. By default, enabled for indexed columns only
2. In my opinion, there seems to be some stylistic issue after the semicolon.
##########
docs/_docs/SQL/schemas.adoc:
##########
@@ -92,3 +92,44 @@ If you do not use this parameter, the cache name is defined
in the following for
....
SQL_<SCHEMA_NAME>_<TABLE_NAME>
....
+
+
+== Validating Data Against the Schema
+
+Ignite can verify that values inserted into a table match the column types and
constraints declared in its SQL schema. Validation is disabled by default;
enable the server-side check on every node before startup:
+
+[tabs]
+--
+tab:Java[]
+[source,java]
+----
+SqlConfiguration sqlCfg = new SqlConfiguration()
+ .setValidationEnabled(true);
+
+IgniteConfiguration cfg = new IgniteConfiguration()
+ .setSqlConfiguration(sqlCfg);
+----
+
+tab:XML[]
+[source,xml]
+----
+<property name="sqlConfiguration">
+ <bean class="org.apache.ignite.configuration.SqlConfiguration">
+ <property name="validationEnabled" value="true"/>
+ </bean>
+</property>
+----
+--
+
+When validation is enabled, Ignite runs extra checks for each SQL `INSERT`,
`MERGE`, and `UPDATE` statement as well as cache API calls that modify
SQL-managed tables and rejects data that breaks the schema.
+Violations raise an `IgniteSQLException`, so the application can handle the
error and the incorrect values are not stored.
Review Comment:
As far as I remember, sometimes it's not IgniteSQLException
##########
modules/core/src/main/java/org/apache/ignite/configuration/SqlConfiguration.java:
##########
@@ -51,7 +51,12 @@ public class SqlConfiguration {
/** SQL plan history size. */
private int sqlPlanHistSize = -1;
- /** Enable validation of key & values against sql schema. */
+ /**
+ * Enables validation of cache keys and values against the SQL schema that
describes the cache.
+ * When turned on, Ignite checks runtime types, nullability and
length/precision constraints before
Review Comment:
Nullability and precision are checked even without this flag.
--
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]