-
Notifications
You must be signed in to change notification settings - Fork 43
Document SQL_EXPR #3643
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Document SQL_EXPR #3643
Conversation
f307eb5 to
a65890c
Compare
e9c06bf to
01206cf
Compare
ImeevMA
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi! Thank you for the patch. I have three comments, but they are all minor and can be ignored.
Also, I didn't mention it, but it would be nice to add that SQL_EXPR functions can be created when creating a SQL CHECK constraint using SQL. Moreover, if the above constraint is dropped, the SQL_EXPR function is not removed, which may not be obvious.
| t.assert_equals(age_err:unpack().message, 'Check constraint \'check_person\' failed for tuple') | ||
| t.assert_equals(name_err:unpack().message, 'Check constraint \'check_person\' failed for tuple') | ||
| end) | ||
| end No newline at end of file |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add a newline.
| box.schema.func.create('check_person', { | ||
| language = 'SQL_EXPR', | ||
| is_deterministic = true, | ||
| body = [["age" > 21 AND "name" !='Admin']] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It might be better to add space between != and Admin.
| ~~~~~~~~~~~~~~~~~~~~ | ||
|
|
||
| Constraints use stored Lua functions, which must return ``true`` when the constraint | ||
| Constraints use stored Lua functions or :ref:`SQL expressions <sql_expressions>`, which must return ``true`` when the constraint |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure it's worth mentioning that the Lua and SQL_EXPR functions can be used as constraints. For example, C functions can also be used as constraints. Maybe not mention it here?
01206cf to
d38bb61
Compare
xuniq
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The new structure seems good to me.
| Using the :ref:`body <function_options_body>` option, you can make a function "persistent". | ||
| In this case, the function is "persistent" because its definition is stored in a snapshot (the :ref:`box.space._func <box_space-func>` system space) and can be recovered if the server restarts. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| Using the :ref:`body <function_options_body>` option, you can make a function "persistent". | |
| In this case, the function is "persistent" because its definition is stored in a snapshot (the :ref:`box.space._func <box_space-func>` system space) and can be recovered if the server restarts. | |
| Using the :ref:`body <function_options_body>` option, you can make a function *persistent*. | |
| In this case, the function is persistent because its definition is stored in a snapshot (the :ref:`box.space._func <box_space-func>` system space) and can be recovered if the server restarts. |
|
|
||
| Whether the function should be executed in an isolated environment. | ||
| This means that any operation that accesses the world outside the sandbox is forbidden or has no effect. | ||
| Therefore a sandboxed function can only use modules and functions |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| Therefore a sandboxed function can only use modules and functions | |
| Therefore, a sandboxed function can only use modules and functions |
d38bb61 to
c38bb41
Compare
function_optionstable description. The function description now contains the SQL_EXPR example for a tuple constraint. The language attribute description is extended with the newSQL_EXPRvalue.