On 7 May 2019, at 20:47, Kirill Shcherbatov <kshcherbatov@tarantool.org> wrote:

;
> + if (sql_bind_decode(&bind, i + 1, &new_tuple) != 0 ||
> +     sql_bind_column(ck_constraint->stmt, &bind, i + 1) != 0) {
> + diag_set(ClientError, ER_CK_CONSTRAINT_FAILED,
> + ck_constraint->def->name,
> + ck_constraint->def->expr_str);
> + return -1;
>This looks like a pessimization to me. Depending on the >code flow,
>some of the tuple fields may not be accessed at all. Is it >really
>necessary to decode them so agressibvely here?
>Especially since
>you encode *all* space fields.

I'll try to walk though the AST tree and prepare the map of fields that are involved in expression (on check compile operation);
Here there would be binding of **used** fields.

What do you think?

To be honest, I don’t get what Konstantin really meant in his next letter.
I’m ok with your approach.