superminkfan commented on code in PR #12423: URL: https://github.com/apache/ignite/pull/12423#discussion_r2450395576
########## 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: Clarified the schema validation documentation so it explains that SQL clients receive an IgniteSQLException while cache API callers see a CacheException rooted in the same SQL error. Verified that validation failures originate from QueryTypeDescriptorImpl.validateProps, surface as IgniteSQLException, and are translated to cache-layer CacheExceptions through GridCacheContext, IgniteUtils.cast, and GridCacheUtils.convertToCacheException -- 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]
