Details
-
Technical task
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Fixed
-
10.3(EOL)
-
10.2.2-3, 10.2.2-1, 10.2.2-2, 10.2.2-4, 10.1.18
Description
Add support for the ROW data type variables in stored routines according to this SQL Standard syntax:
<row type> ::= ROW <row type body>
|
|
<row type body> ::= <left paren> <field definition> [ { <comma> <field definition> }... ] <right paren>
|
|
<field definition> ::= <field name> <data type>
|
|
<data type> ::= <predefined type>
|
and add support for a new expression type, a ROW field reference, as follows:
<field reference> ::= <row variable> <period> <field name>
|
where <row variable> is a stored routine variable declared using <row type>.
Example:
DELIMITER $$
|
CREATE PROCEDURE p1() |
BEGIN
|
DECLARE a ROW (c1 INT, c2 VARCHAR(10)); |
SET a.c1= 10; |
SET a.c2= 'test'; |
INSERT INTO t1 VALUES (a.c1, a.c2); |
END; |
$$
|
DELIMITER ;
|
CALL p1();
|
This task is needed to create infrastructure for MDEV-10593
This task is also needed as a prerequisite for MDEV-10581, where this statement:
FOR rec IN cursor |
will automatically declare an index variable rec of the ROW data type, according to the cursor structure.
Row data type features:
- Declaration of a ROW type stored routine variable (both local variables and parameters)
- Declaration of a ROW type stored procedure OUT parameter
- Default values in a ROW type variable declaration (e.g. DEFAULT ROW(1,2))
- Assignment of a ROW type variable from another ROW type variable (using the SET command and the := operator in sql_mode=ORACLE)
- Assignment of a ROW type variable from a ROW() function result (using the SET command and the := operator in sql_mode=ORACLE)
- Passing a ROW type variable and a ROW() function result to stored routines
- Comparison of a ROW type variable to another ROW type variable
- Comparison of a ROW type variable to ROW() function
Row field features:
ROW fields (members) will act as normal variables, and will be able to appear in all query parts where an SP variable is allowed:
- assignment (using the SET command)
SET a.x= 10, a.y=20, a.z= b.z;
- assignment (sql_mode=ORACLE specific syntax)
a.x:= 10;
a.x:= b.x;
- passing to functions and operators
SELECT f1(rec.a), rec.a<10;
- clauses: select list, WHERE, HAVING, LIMIT, etc
SELECT var.a, t1.b FROM t1 WHERE t1.b=var.b LIMIT var.c;
- INSERT values
INSERT INTO t1 VALUES (rec.a, rec.b, rec.c);
- SELECT .. INTO targets
SELECT a,b INTO rec.a, rec.b FROM t1 WHERE t1.id=10;
- Dynamic SQL out parameters (EXECUTE and EXECUTE IMMEDIATE)
EXECUTE IMMEDIATE 'CALL proc_with_out_param(?)' USING rec.a;
Features not supported:
The following features are out of scope of this task and will be implemented separately:
- Returning a ROW type expression from a stored function (see
MDEV-12252). This will need some grammar change to support field names after parentheses:SELECT f1().x FROM DUAL;
- Returning a ROW type expression from a built-in hybrid type function, such as CASE, IF, etc.
- ROW of ROWs
Attachments
Issue Links
- blocks
-
MDEV-10581 sql_mode=ORACLE: Explicit cursor FOR LOOP
-
- Closed
-
-
MDEV-10593 sql_mode=ORACLE: TYPE .. AS OBJECT: basic functionality
-
- Open
-
-
MDEV-12011 sql_mode=ORACLE: cursor%ROWTYPE in variable declarations
-
- Closed
-
-
MDEV-12133 sql_mode=ORACLE: table%ROWTYPE in variable declarations
-
- Closed
-
-
MDEV-12252 ROW data type for stored function return values
-
- Closed
-
- is blocked by
-
MDEV-10577 sql_mode=ORACLE: %TYPE in variable declarations
-
- Closed
-
- relates to
-
MDEV-11210 TYPE OF and %TYPE in stored function RETURN data type
-
- Open
-
-
MDEV-13527 Crash when EXPLAIN SELECT .. INTO row_sp_variable.field
-
- Closed
-
-
MDEV-31250 ROW variables do not get assigned from subselects
-
- Closed
-
-
MDEV-32380 Array data type for stored routnes
-
- Stalled
-
Activity
Field | Original Value | New Value |
---|---|---|
Link |
This issue blocks |
Description |
Add support for the {{ROW}} data type variables in stored routines according to this SQL Standard syntax:
{noformat} <row type> ::= ROW <row type body> <row type body> ::= <left paren> <field definition> [ { <comma> <field definition> }... ] <right paren> <field definition> ::= <field name> <data type> <data type> ::= <predefined type> {noformat} and add support for a new expression type, a ROW field reference, as follows: {noformat} <field reference> ::= <row variable> <period> <field name> {noformat} where {{<row variable>}} is a stored routine variable declared using {{<row type>}}. Example: {code:sql} DELIMITER $$ CREATE PROCEDURE p1() BEGIN DECLARE a ROW (c1 INT, c2 VARCHAR(10)); SET a.c1= 10; SET a.c2= 'test'; INSERT INTO t1 VALUES (a.c1, a.c2); END; DELIMITER ; CALL p1(); {code} This task is needed as a prerequisite for Extended SQL Standard {{FOR}} functionality will be implemented in separate tasks, e.g.: - This task is limited to only scalar ROW elements. ROW inside ROW will be done in a separate task. - DEFAULT clause in DECLARE will not be supported for ROW variables. It will be done in a separate task. - ROW variables won't be supported as parameters to native functions and stored routines. It will be done in a separate task. |
Add support for the {{ROW}} data type variables in stored routines according to this SQL Standard syntax:
{noformat} <row type> ::= ROW <row type body> <row type body> ::= <left paren> <field definition> [ { <comma> <field definition> }... ] <right paren> <field definition> ::= <field name> <data type> <data type> ::= <predefined type> {noformat} and add support for a new expression type, a ROW field reference, as follows: {noformat} <field reference> ::= <row variable> <period> <field name> {noformat} where {{<row variable>}} is a stored routine variable declared using {{<row type>}}. Example: {code:sql} DELIMITER $$ CREATE PROCEDURE p1() BEGIN DECLARE a ROW (c1 INT, c2 VARCHAR(10)); SET a.c1= 10; SET a.c2= 'test'; INSERT INTO t1 VALUES (a.c1, a.c2); END; $$ DELIMITER ; CALL p1(); {code} This task is needed as a prerequisite for Extended SQL Standard {{FOR}} functionality will be implemented in separate tasks, e.g.: - This task is limited to only scalar ROW elements. ROW inside ROW will be done in a separate task. - DEFAULT clause in DECLARE will not be supported for ROW variables. It will be done in a separate task. - ROW variables won't be supported as parameters to native functions and stored routines. It will be done in a separate task. |
Description |
Add support for the {{ROW}} data type variables in stored routines according to this SQL Standard syntax:
{noformat} <row type> ::= ROW <row type body> <row type body> ::= <left paren> <field definition> [ { <comma> <field definition> }... ] <right paren> <field definition> ::= <field name> <data type> <data type> ::= <predefined type> {noformat} and add support for a new expression type, a ROW field reference, as follows: {noformat} <field reference> ::= <row variable> <period> <field name> {noformat} where {{<row variable>}} is a stored routine variable declared using {{<row type>}}. Example: {code:sql} DELIMITER $$ CREATE PROCEDURE p1() BEGIN DECLARE a ROW (c1 INT, c2 VARCHAR(10)); SET a.c1= 10; SET a.c2= 'test'; INSERT INTO t1 VALUES (a.c1, a.c2); END; $$ DELIMITER ; CALL p1(); {code} This task is needed as a prerequisite for Extended SQL Standard {{FOR}} functionality will be implemented in separate tasks, e.g.: - This task is limited to only scalar ROW elements. ROW inside ROW will be done in a separate task. - DEFAULT clause in DECLARE will not be supported for ROW variables. It will be done in a separate task. - ROW variables won't be supported as parameters to native functions and stored routines. It will be done in a separate task. |
Add support for the {{ROW}} data type variables in stored routines according to this SQL Standard syntax:
{noformat} <row type> ::= ROW <row type body> <row type body> ::= <left paren> <field definition> [ { <comma> <field definition> }... ] <right paren> <field definition> ::= <field name> <data type> <data type> ::= <predefined type> {noformat} and add support for a new expression type, a ROW field reference, as follows: {noformat} <field reference> ::= <row variable> <period> <field name> {noformat} where {{<row variable>}} is a stored routine variable declared using {{<row type>}}. Example: {code:sql} DELIMITER $$ CREATE PROCEDURE p1() BEGIN DECLARE a ROW (c1 INT, c2 VARCHAR(10)); SET a.c1= 10; SET a.c2= 'test'; INSERT INTO t1 VALUES (a.c1, a.c2); END; $$ DELIMITER ; CALL p1(); {code} This task is needed as a prerequisite for {code:sql} FOR rec IN cursor {code} will automatically declare an index variable {{rec}} of a {{ROW}} data type, according to the cursor structure. Therefore, this task includes only basic {{ROW}} functionality. Extended SQL Standard {{FOR}} functionality will be implemented in separate tasks, e.g.: - This task is limited to only scalar ROW elements. ROW inside ROW will be done in a separate task. - DEFAULT clause in DECLARE will not be supported for ROW variables. It will be done in a separate task. - ROW variables won't be supported as parameters to native functions and stored routines. It will be done in a separate task. |
Description |
Add support for the {{ROW}} data type variables in stored routines according to this SQL Standard syntax:
{noformat} <row type> ::= ROW <row type body> <row type body> ::= <left paren> <field definition> [ { <comma> <field definition> }... ] <right paren> <field definition> ::= <field name> <data type> <data type> ::= <predefined type> {noformat} and add support for a new expression type, a ROW field reference, as follows: {noformat} <field reference> ::= <row variable> <period> <field name> {noformat} where {{<row variable>}} is a stored routine variable declared using {{<row type>}}. Example: {code:sql} DELIMITER $$ CREATE PROCEDURE p1() BEGIN DECLARE a ROW (c1 INT, c2 VARCHAR(10)); SET a.c1= 10; SET a.c2= 'test'; INSERT INTO t1 VALUES (a.c1, a.c2); END; $$ DELIMITER ; CALL p1(); {code} This task is needed as a prerequisite for {code:sql} FOR rec IN cursor {code} will automatically declare an index variable {{rec}} of a {{ROW}} data type, according to the cursor structure. Therefore, this task includes only basic {{ROW}} functionality. Extended SQL Standard {{FOR}} functionality will be implemented in separate tasks, e.g.: - This task is limited to only scalar ROW elements. ROW inside ROW will be done in a separate task. - DEFAULT clause in DECLARE will not be supported for ROW variables. It will be done in a separate task. - ROW variables won't be supported as parameters to native functions and stored routines. It will be done in a separate task. |
Add support for the {{ROW}} data type variables in stored routines according to this SQL Standard syntax:
{noformat} <row type> ::= ROW <row type body> <row type body> ::= <left paren> <field definition> [ { <comma> <field definition> }... ] <right paren> <field definition> ::= <field name> <data type> <data type> ::= <predefined type> {noformat} and add support for a new expression type, a ROW field reference, as follows: {noformat} <field reference> ::= <row variable> <period> <field name> {noformat} where {{<row variable>}} is a stored routine variable declared using {{<row type>}}. Example: {code:sql} DELIMITER $$ CREATE PROCEDURE p1() BEGIN DECLARE a ROW (c1 INT, c2 VARCHAR(10)); SET a.c1= 10; SET a.c2= 'test'; INSERT INTO t1 VALUES (a.c1, a.c2); END; $$ DELIMITER ; CALL p1(); {code} This task is needed as a prerequisite for {code:sql} FOR rec IN cursor {code} will automatically declare an index variable {{rec}} of the {{ROW}} data type, according to the cursor structure. Therefore, this task includes only basic {{ROW}} functionality. Extended SQL Standard {{FOR}} functionality will be implemented in separate tasks, e.g.: - This task is limited to only scalar ROW elements. ROW inside ROW will be done in a separate task. - DEFAULT clause in DECLARE will not be supported for ROW variables. It will be done in a separate task. - ROW variables won't be supported as parameters to native functions and stored routines. It will be done in a separate task. |
Description |
Add support for the {{ROW}} data type variables in stored routines according to this SQL Standard syntax:
{noformat} <row type> ::= ROW <row type body> <row type body> ::= <left paren> <field definition> [ { <comma> <field definition> }... ] <right paren> <field definition> ::= <field name> <data type> <data type> ::= <predefined type> {noformat} and add support for a new expression type, a ROW field reference, as follows: {noformat} <field reference> ::= <row variable> <period> <field name> {noformat} where {{<row variable>}} is a stored routine variable declared using {{<row type>}}. Example: {code:sql} DELIMITER $$ CREATE PROCEDURE p1() BEGIN DECLARE a ROW (c1 INT, c2 VARCHAR(10)); SET a.c1= 10; SET a.c2= 'test'; INSERT INTO t1 VALUES (a.c1, a.c2); END; $$ DELIMITER ; CALL p1(); {code} This task is needed as a prerequisite for {code:sql} FOR rec IN cursor {code} will automatically declare an index variable {{rec}} of the {{ROW}} data type, according to the cursor structure. Therefore, this task includes only basic {{ROW}} functionality. Extended SQL Standard {{FOR}} functionality will be implemented in separate tasks, e.g.: - This task is limited to only scalar ROW elements. ROW inside ROW will be done in a separate task. - DEFAULT clause in DECLARE will not be supported for ROW variables. It will be done in a separate task. - ROW variables won't be supported as parameters to native functions and stored routines. It will be done in a separate task. |
Add support for the {{ROW}} data type variables in stored routines according to this SQL Standard syntax:
{noformat} <row type> ::= ROW <row type body> <row type body> ::= <left paren> <field definition> [ { <comma> <field definition> }... ] <right paren> <field definition> ::= <field name> <data type> <data type> ::= <predefined type> {noformat} and add support for a new expression type, a ROW field reference, as follows: {noformat} <field reference> ::= <row variable> <period> <field name> {noformat} where {{<row variable>}} is a stored routine variable declared using {{<row type>}}. Example: {code:sql} DELIMITER $$ CREATE PROCEDURE p1() BEGIN DECLARE a ROW (c1 INT, c2 VARCHAR(10)); SET a.c1= 10; SET a.c2= 'test'; INSERT INTO t1 VALUES (a.c1, a.c2); END; $$ DELIMITER ; CALL p1(); {code} This task is needed as a prerequisite for {code:sql} FOR rec IN cursor {code} will automatically declare an index variable {{rec}} of the {{ROW}} data type, according to the cursor structure. Therefore, this task includes only basic {{ROW}} functionality. Extended SQL Standard {{ROW}} functionality will be implemented in separate tasks, e.g.: - This task is limited to only scalar ROW elements. ROW inside ROW will be done in a separate task. - DEFAULT clause in DECLARE will not be supported for ROW variables. It will be done in a separate task. - ROW variables won't be supported as parameters to native functions and stored routines. It will be done in a separate task. |
Description |
Add support for the {{ROW}} data type variables in stored routines according to this SQL Standard syntax:
{noformat} <row type> ::= ROW <row type body> <row type body> ::= <left paren> <field definition> [ { <comma> <field definition> }... ] <right paren> <field definition> ::= <field name> <data type> <data type> ::= <predefined type> {noformat} and add support for a new expression type, a ROW field reference, as follows: {noformat} <field reference> ::= <row variable> <period> <field name> {noformat} where {{<row variable>}} is a stored routine variable declared using {{<row type>}}. Example: {code:sql} DELIMITER $$ CREATE PROCEDURE p1() BEGIN DECLARE a ROW (c1 INT, c2 VARCHAR(10)); SET a.c1= 10; SET a.c2= 'test'; INSERT INTO t1 VALUES (a.c1, a.c2); END; $$ DELIMITER ; CALL p1(); {code} This task is needed as a prerequisite for {code:sql} FOR rec IN cursor {code} will automatically declare an index variable {{rec}} of the {{ROW}} data type, according to the cursor structure. Therefore, this task includes only basic {{ROW}} functionality. Extended SQL Standard {{ROW}} functionality will be implemented in separate tasks, e.g.: - This task is limited to only scalar ROW elements. ROW inside ROW will be done in a separate task. - DEFAULT clause in DECLARE will not be supported for ROW variables. It will be done in a separate task. - ROW variables won't be supported as parameters to native functions and stored routines. It will be done in a separate task. |
Add support for the {{ROW}} data type variables in stored routines according to this SQL Standard syntax:
{noformat} <row type> ::= ROW <row type body> <row type body> ::= <left paren> <field definition> [ { <comma> <field definition> }... ] <right paren> <field definition> ::= <field name> <data type> <data type> ::= <predefined type> {noformat} and add support for a new expression type, a ROW field reference, as follows: {noformat} <field reference> ::= <row variable> <period> <field name> {noformat} where {{<row variable>}} is a stored routine variable declared using {{<row type>}}. Example: {code:sql} DELIMITER $$ CREATE PROCEDURE p1() BEGIN DECLARE a ROW (c1 INT, c2 VARCHAR(10)); SET a.c1= 10; SET a.c2= 'test'; INSERT INTO t1 VALUES (a.c1, a.c2); END; $$ DELIMITER ; CALL p1(); {code} This task is needed as a prerequisite for {code:sql} FOR rec IN cursor {code} will automatically declare an index variable {{rec}} of the {{ROW}} data type, according to the cursor structure. Therefore, this task includes only basic {{ROW}} functionality. Extended SQL Standard {{ROW}} functionality will be implemented in separate tasks, e.g.: - This task is limited to only scalar ROW elements. ROW inside ROW will be done in a separate task. - ROW variables won't be supported as parameters to native functions and stored routines. It will be done in a separate task. |
Link | This issue blocks MDEV-10593 [ MDEV-10593 ] |
Description |
Add support for the {{ROW}} data type variables in stored routines according to this SQL Standard syntax:
{noformat} <row type> ::= ROW <row type body> <row type body> ::= <left paren> <field definition> [ { <comma> <field definition> }... ] <right paren> <field definition> ::= <field name> <data type> <data type> ::= <predefined type> {noformat} and add support for a new expression type, a ROW field reference, as follows: {noformat} <field reference> ::= <row variable> <period> <field name> {noformat} where {{<row variable>}} is a stored routine variable declared using {{<row type>}}. Example: {code:sql} DELIMITER $$ CREATE PROCEDURE p1() BEGIN DECLARE a ROW (c1 INT, c2 VARCHAR(10)); SET a.c1= 10; SET a.c2= 'test'; INSERT INTO t1 VALUES (a.c1, a.c2); END; $$ DELIMITER ; CALL p1(); {code} This task is needed as a prerequisite for {code:sql} FOR rec IN cursor {code} will automatically declare an index variable {{rec}} of the {{ROW}} data type, according to the cursor structure. Therefore, this task includes only basic {{ROW}} functionality. Extended SQL Standard {{ROW}} functionality will be implemented in separate tasks, e.g.: - This task is limited to only scalar ROW elements. ROW inside ROW will be done in a separate task. - ROW variables won't be supported as parameters to native functions and stored routines. It will be done in a separate task. |
Add support for the {{ROW}} data type variables in stored routines according to this SQL Standard syntax:
{noformat} <row type> ::= ROW <row type body> <row type body> ::= <left paren> <field definition> [ { <comma> <field definition> }... ] <right paren> <field definition> ::= <field name> <data type> <data type> ::= <predefined type> {noformat} and add support for a new expression type, a ROW field reference, as follows: {noformat} <field reference> ::= <row variable> <period> <field name> {noformat} where {{<row variable>}} is a stored routine variable declared using {{<row type>}}. Example: {code:sql} DELIMITER $$ CREATE PROCEDURE p1() BEGIN DECLARE a ROW (c1 INT, c2 VARCHAR(10)); SET a.c1= 10; SET a.c2= 'test'; INSERT INTO t1 VALUES (a.c1, a.c2); END; $$ DELIMITER ; CALL p1(); {code} This task is needed as a prerequisite for {code:sql} FOR rec IN cursor {code} will automatically declare an index variable {{rec}} of the {{ROW}} data type, according to the cursor structure. Therefore, this task includes only basic {{ROW}} functionality. h2. Row data type features: - Declaration of a ROW type stored routine variable (both local variables and parameters) - Declaration of a ROW type stored procedure OUT parameter - Default values in a ROW type variable declaration (e.g. {{DEFAULT ROW(1,2)}}) - Assignment of a ROW type variable from another ROW type variable (using the {{:=}} operator and the {{SET}} command) - Assignment of a ROW type variable from a ROW() function result (using the {{:=}} operator and the {{SET}} command) - Passing a ROW type variable and a {{ROW()}} function result to stored routines - Comparison of a ROW type variable to another ROW type variable - Comparison of a ROW type variable to ROW() function h2. Row field features: ROW fields (members) will act as normal variables, and will be able to appear in all query parts where an SP variable is allowed: - assignment (using the {{:=}} operator and the {{SET}} command) - clauses: select list, {{WHERE}}, {{HAVING}}, {{LIMIT}}, etc - {{INSERT}} values - {{SELECT .. INTO}} targets - Dynamic SQL out parameters ({{EXECUTE}} and {{EXECUTE IMMEDIATE}}) h2. Features not supported: The following features are out of scope of this task and will be implemented separately: - Returning a ROW type expression from a stored function, This will need some grammar change to support field names after parentheses: {code:sql} SELECT f1().x FROM DUAL; {code} - Returning a ROW type expression from a built-in hybrid type function, such as {{CASE}}, {{IF}}, etc. - ROW of ROWs |
Description |
Add support for the {{ROW}} data type variables in stored routines according to this SQL Standard syntax:
{noformat} <row type> ::= ROW <row type body> <row type body> ::= <left paren> <field definition> [ { <comma> <field definition> }... ] <right paren> <field definition> ::= <field name> <data type> <data type> ::= <predefined type> {noformat} and add support for a new expression type, a ROW field reference, as follows: {noformat} <field reference> ::= <row variable> <period> <field name> {noformat} where {{<row variable>}} is a stored routine variable declared using {{<row type>}}. Example: {code:sql} DELIMITER $$ CREATE PROCEDURE p1() BEGIN DECLARE a ROW (c1 INT, c2 VARCHAR(10)); SET a.c1= 10; SET a.c2= 'test'; INSERT INTO t1 VALUES (a.c1, a.c2); END; $$ DELIMITER ; CALL p1(); {code} This task is needed as a prerequisite for {code:sql} FOR rec IN cursor {code} will automatically declare an index variable {{rec}} of the {{ROW}} data type, according to the cursor structure. Therefore, this task includes only basic {{ROW}} functionality. h2. Row data type features: - Declaration of a ROW type stored routine variable (both local variables and parameters) - Declaration of a ROW type stored procedure OUT parameter - Default values in a ROW type variable declaration (e.g. {{DEFAULT ROW(1,2)}}) - Assignment of a ROW type variable from another ROW type variable (using the {{:=}} operator and the {{SET}} command) - Assignment of a ROW type variable from a ROW() function result (using the {{:=}} operator and the {{SET}} command) - Passing a ROW type variable and a {{ROW()}} function result to stored routines - Comparison of a ROW type variable to another ROW type variable - Comparison of a ROW type variable to ROW() function h2. Row field features: ROW fields (members) will act as normal variables, and will be able to appear in all query parts where an SP variable is allowed: - assignment (using the {{:=}} operator and the {{SET}} command) - clauses: select list, {{WHERE}}, {{HAVING}}, {{LIMIT}}, etc - {{INSERT}} values - {{SELECT .. INTO}} targets - Dynamic SQL out parameters ({{EXECUTE}} and {{EXECUTE IMMEDIATE}}) h2. Features not supported: The following features are out of scope of this task and will be implemented separately: - Returning a ROW type expression from a stored function, This will need some grammar change to support field names after parentheses: {code:sql} SELECT f1().x FROM DUAL; {code} - Returning a ROW type expression from a built-in hybrid type function, such as {{CASE}}, {{IF}}, etc. - ROW of ROWs |
Add support for the {{ROW}} data type variables in stored routines according to this SQL Standard syntax:
{noformat} <row type> ::= ROW <row type body> <row type body> ::= <left paren> <field definition> [ { <comma> <field definition> }... ] <right paren> <field definition> ::= <field name> <data type> <data type> ::= <predefined type> {noformat} and add support for a new expression type, a ROW field reference, as follows: {noformat} <field reference> ::= <row variable> <period> <field name> {noformat} where {{<row variable>}} is a stored routine variable declared using {{<row type>}}. Example: {code:sql} DELIMITER $$ CREATE PROCEDURE p1() BEGIN DECLARE a ROW (c1 INT, c2 VARCHAR(10)); SET a.c1= 10; SET a.c2= 'test'; INSERT INTO t1 VALUES (a.c1, a.c2); END; $$ DELIMITER ; CALL p1(); {code} This task is needed as a prerequisite for {code:sql} FOR rec IN cursor {code} will automatically declare an index variable {{rec}} of the {{ROW}} data type, according to the cursor structure. Therefore, this task includes only basic {{ROW}} functionality. h2. Row data type features: - Declaration of a ROW type stored routine variable (both local variables and parameters) - Declaration of a ROW type stored procedure OUT parameter - Default values in a ROW type variable declaration (e.g. {{DEFAULT ROW(1,2)}}) - Assignment of a ROW type variable from another ROW type variable (using the {{:=}} operator and the {{SET}} command) - Assignment of a ROW type variable from a ROW() function result (using the {{:=}} operator and the {{SET}} command) - Passing a ROW type variable and a {{ROW()}} function result to stored routines - Comparison of a ROW type variable to another ROW type variable - Comparison of a ROW type variable to ROW() function h2. Row field features: ROW fields (members) will act as normal variables, and will be able to appear in all query parts where an SP variable is allowed: - assignment (using the {{:=}} operator and the {{SET}} command) - clauses: select list, {{WHERE}}, {{HAVING}}, {{LIMIT}}, etc - {{INSERT}} values - {{SELECT .. INTO}} targets - Dynamic SQL out parameters ({{EXECUTE}} and {{EXECUTE IMMEDIATE}}) h2. Features not supported: The following features are out of scope of this task and will be implemented separately: - Returning a ROW type expression from a stored function. This will need some grammar change to support field names after parentheses: {code:sql} SELECT f1().x FROM DUAL; {code} - Returning a ROW type expression from a built-in hybrid type function, such as {{CASE}}, {{IF}}, etc. - ROW of ROWs |
Description |
Add support for the {{ROW}} data type variables in stored routines according to this SQL Standard syntax:
{noformat} <row type> ::= ROW <row type body> <row type body> ::= <left paren> <field definition> [ { <comma> <field definition> }... ] <right paren> <field definition> ::= <field name> <data type> <data type> ::= <predefined type> {noformat} and add support for a new expression type, a ROW field reference, as follows: {noformat} <field reference> ::= <row variable> <period> <field name> {noformat} where {{<row variable>}} is a stored routine variable declared using {{<row type>}}. Example: {code:sql} DELIMITER $$ CREATE PROCEDURE p1() BEGIN DECLARE a ROW (c1 INT, c2 VARCHAR(10)); SET a.c1= 10; SET a.c2= 'test'; INSERT INTO t1 VALUES (a.c1, a.c2); END; $$ DELIMITER ; CALL p1(); {code} This task is needed as a prerequisite for {code:sql} FOR rec IN cursor {code} will automatically declare an index variable {{rec}} of the {{ROW}} data type, according to the cursor structure. Therefore, this task includes only basic {{ROW}} functionality. h2. Row data type features: - Declaration of a ROW type stored routine variable (both local variables and parameters) - Declaration of a ROW type stored procedure OUT parameter - Default values in a ROW type variable declaration (e.g. {{DEFAULT ROW(1,2)}}) - Assignment of a ROW type variable from another ROW type variable (using the {{:=}} operator and the {{SET}} command) - Assignment of a ROW type variable from a ROW() function result (using the {{:=}} operator and the {{SET}} command) - Passing a ROW type variable and a {{ROW()}} function result to stored routines - Comparison of a ROW type variable to another ROW type variable - Comparison of a ROW type variable to ROW() function h2. Row field features: ROW fields (members) will act as normal variables, and will be able to appear in all query parts where an SP variable is allowed: - assignment (using the {{:=}} operator and the {{SET}} command) - clauses: select list, {{WHERE}}, {{HAVING}}, {{LIMIT}}, etc - {{INSERT}} values - {{SELECT .. INTO}} targets - Dynamic SQL out parameters ({{EXECUTE}} and {{EXECUTE IMMEDIATE}}) h2. Features not supported: The following features are out of scope of this task and will be implemented separately: - Returning a ROW type expression from a stored function. This will need some grammar change to support field names after parentheses: {code:sql} SELECT f1().x FROM DUAL; {code} - Returning a ROW type expression from a built-in hybrid type function, such as {{CASE}}, {{IF}}, etc. - ROW of ROWs |
Add support for the {{ROW}} data type variables in stored routines according to this SQL Standard syntax:
{noformat} <row type> ::= ROW <row type body> <row type body> ::= <left paren> <field definition> [ { <comma> <field definition> }... ] <right paren> <field definition> ::= <field name> <data type> <data type> ::= <predefined type> {noformat} and add support for a new expression type, a ROW field reference, as follows: {noformat} <field reference> ::= <row variable> <period> <field name> {noformat} where {{<row variable>}} is a stored routine variable declared using {{<row type>}}. Example: {code:sql} DELIMITER $$ CREATE PROCEDURE p1() BEGIN DECLARE a ROW (c1 INT, c2 VARCHAR(10)); SET a.c1= 10; SET a.c2= 'test'; INSERT INTO t1 VALUES (a.c1, a.c2); END; $$ DELIMITER ; CALL p1(); {code} This task is needed to create infrastructure for MDEV-10593 This task is also needed as a prerequisite for {code:sql} FOR rec IN cursor {code} will automatically declare an index variable {{rec}} of the {{ROW}} data type, according to the cursor structure. Therefore, this task includes only basic {{ROW}} functionality. h2. Row data type features: - Declaration of a ROW type stored routine variable (both local variables and parameters) - Declaration of a ROW type stored procedure OUT parameter - Default values in a ROW type variable declaration (e.g. {{DEFAULT ROW(1,2)}}) - Assignment of a ROW type variable from another ROW type variable (using the {{:=}} operator and the {{SET}} command) - Assignment of a ROW type variable from a ROW() function result (using the {{:=}} operator and the {{SET}} command) - Passing a ROW type variable and a {{ROW()}} function result to stored routines - Comparison of a ROW type variable to another ROW type variable - Comparison of a ROW type variable to ROW() function h2. Row field features: ROW fields (members) will act as normal variables, and will be able to appear in all query parts where an SP variable is allowed: - assignment (using the {{:=}} operator and the {{SET}} command) - clauses: select list, {{WHERE}}, {{HAVING}}, {{LIMIT}}, etc - {{INSERT}} values - {{SELECT .. INTO}} targets - Dynamic SQL out parameters ({{EXECUTE}} and {{EXECUTE IMMEDIATE}}) h2. Features not supported: The following features are out of scope of this task and will be implemented separately: - Returning a ROW type expression from a stored function. This will need some grammar change to support field names after parentheses: {code:sql} SELECT f1().x FROM DUAL; {code} - Returning a ROW type expression from a built-in hybrid type function, such as {{CASE}}, {{IF}}, etc. - ROW of ROWs |
Description |
Add support for the {{ROW}} data type variables in stored routines according to this SQL Standard syntax:
{noformat} <row type> ::= ROW <row type body> <row type body> ::= <left paren> <field definition> [ { <comma> <field definition> }... ] <right paren> <field definition> ::= <field name> <data type> <data type> ::= <predefined type> {noformat} and add support for a new expression type, a ROW field reference, as follows: {noformat} <field reference> ::= <row variable> <period> <field name> {noformat} where {{<row variable>}} is a stored routine variable declared using {{<row type>}}. Example: {code:sql} DELIMITER $$ CREATE PROCEDURE p1() BEGIN DECLARE a ROW (c1 INT, c2 VARCHAR(10)); SET a.c1= 10; SET a.c2= 'test'; INSERT INTO t1 VALUES (a.c1, a.c2); END; $$ DELIMITER ; CALL p1(); {code} This task is needed to create infrastructure for MDEV-10593 This task is also needed as a prerequisite for {code:sql} FOR rec IN cursor {code} will automatically declare an index variable {{rec}} of the {{ROW}} data type, according to the cursor structure. Therefore, this task includes only basic {{ROW}} functionality. h2. Row data type features: - Declaration of a ROW type stored routine variable (both local variables and parameters) - Declaration of a ROW type stored procedure OUT parameter - Default values in a ROW type variable declaration (e.g. {{DEFAULT ROW(1,2)}}) - Assignment of a ROW type variable from another ROW type variable (using the {{:=}} operator and the {{SET}} command) - Assignment of a ROW type variable from a ROW() function result (using the {{:=}} operator and the {{SET}} command) - Passing a ROW type variable and a {{ROW()}} function result to stored routines - Comparison of a ROW type variable to another ROW type variable - Comparison of a ROW type variable to ROW() function h2. Row field features: ROW fields (members) will act as normal variables, and will be able to appear in all query parts where an SP variable is allowed: - assignment (using the {{:=}} operator and the {{SET}} command) - clauses: select list, {{WHERE}}, {{HAVING}}, {{LIMIT}}, etc - {{INSERT}} values - {{SELECT .. INTO}} targets - Dynamic SQL out parameters ({{EXECUTE}} and {{EXECUTE IMMEDIATE}}) h2. Features not supported: The following features are out of scope of this task and will be implemented separately: - Returning a ROW type expression from a stored function. This will need some grammar change to support field names after parentheses: {code:sql} SELECT f1().x FROM DUAL; {code} - Returning a ROW type expression from a built-in hybrid type function, such as {{CASE}}, {{IF}}, etc. - ROW of ROWs |
Add support for the {{ROW}} data type variables in stored routines according to this SQL Standard syntax:
{noformat} <row type> ::= ROW <row type body> <row type body> ::= <left paren> <field definition> [ { <comma> <field definition> }... ] <right paren> <field definition> ::= <field name> <data type> <data type> ::= <predefined type> {noformat} and add support for a new expression type, a ROW field reference, as follows: {noformat} <field reference> ::= <row variable> <period> <field name> {noformat} where {{<row variable>}} is a stored routine variable declared using {{<row type>}}. Example: {code:sql} DELIMITER $$ CREATE PROCEDURE p1() BEGIN DECLARE a ROW (c1 INT, c2 VARCHAR(10)); SET a.c1= 10; SET a.c2= 'test'; INSERT INTO t1 VALUES (a.c1, a.c2); END; $$ DELIMITER ; CALL p1(); {code} This task is needed to create infrastructure for MDEV-10593 This task is also needed as a prerequisite for {code:sql} FOR rec IN cursor {code} will automatically declare an index variable {{rec}} of the {{ROW}} data type, according to the cursor structure. h2. Row data type features: - Declaration of a ROW type stored routine variable (both local variables and parameters) - Declaration of a ROW type stored procedure OUT parameter - Default values in a ROW type variable declaration (e.g. {{DEFAULT ROW(1,2)}}) - Assignment of a ROW type variable from another ROW type variable (using the {{:=}} operator and the {{SET}} command) - Assignment of a ROW type variable from a ROW() function result (using the {{:=}} operator and the {{SET}} command) - Passing a ROW type variable and a {{ROW()}} function result to stored routines - Comparison of a ROW type variable to another ROW type variable - Comparison of a ROW type variable to ROW() function h2. Row field features: ROW fields (members) will act as normal variables, and will be able to appear in all query parts where an SP variable is allowed: - assignment (using the {{:=}} operator and the {{SET}} command) - clauses: select list, {{WHERE}}, {{HAVING}}, {{LIMIT}}, etc - {{INSERT}} values - {{SELECT .. INTO}} targets - Dynamic SQL out parameters ({{EXECUTE}} and {{EXECUTE IMMEDIATE}}) h2. Features not supported: The following features are out of scope of this task and will be implemented separately: - Returning a ROW type expression from a stored function. This will need some grammar change to support field names after parentheses: {code:sql} SELECT f1().x FROM DUAL; {code} - Returning a ROW type expression from a built-in hybrid type function, such as {{CASE}}, {{IF}}, etc. - ROW of ROWs |
Description |
Add support for the {{ROW}} data type variables in stored routines according to this SQL Standard syntax:
{noformat} <row type> ::= ROW <row type body> <row type body> ::= <left paren> <field definition> [ { <comma> <field definition> }... ] <right paren> <field definition> ::= <field name> <data type> <data type> ::= <predefined type> {noformat} and add support for a new expression type, a ROW field reference, as follows: {noformat} <field reference> ::= <row variable> <period> <field name> {noformat} where {{<row variable>}} is a stored routine variable declared using {{<row type>}}. Example: {code:sql} DELIMITER $$ CREATE PROCEDURE p1() BEGIN DECLARE a ROW (c1 INT, c2 VARCHAR(10)); SET a.c1= 10; SET a.c2= 'test'; INSERT INTO t1 VALUES (a.c1, a.c2); END; $$ DELIMITER ; CALL p1(); {code} This task is needed to create infrastructure for MDEV-10593 This task is also needed as a prerequisite for {code:sql} FOR rec IN cursor {code} will automatically declare an index variable {{rec}} of the {{ROW}} data type, according to the cursor structure. h2. Row data type features: - Declaration of a ROW type stored routine variable (both local variables and parameters) - Declaration of a ROW type stored procedure OUT parameter - Default values in a ROW type variable declaration (e.g. {{DEFAULT ROW(1,2)}}) - Assignment of a ROW type variable from another ROW type variable (using the {{:=}} operator and the {{SET}} command) - Assignment of a ROW type variable from a ROW() function result (using the {{:=}} operator and the {{SET}} command) - Passing a ROW type variable and a {{ROW()}} function result to stored routines - Comparison of a ROW type variable to another ROW type variable - Comparison of a ROW type variable to ROW() function h2. Row field features: ROW fields (members) will act as normal variables, and will be able to appear in all query parts where an SP variable is allowed: - assignment (using the {{:=}} operator and the {{SET}} command) - clauses: select list, {{WHERE}}, {{HAVING}}, {{LIMIT}}, etc - {{INSERT}} values - {{SELECT .. INTO}} targets - Dynamic SQL out parameters ({{EXECUTE}} and {{EXECUTE IMMEDIATE}}) h2. Features not supported: The following features are out of scope of this task and will be implemented separately: - Returning a ROW type expression from a stored function. This will need some grammar change to support field names after parentheses: {code:sql} SELECT f1().x FROM DUAL; {code} - Returning a ROW type expression from a built-in hybrid type function, such as {{CASE}}, {{IF}}, etc. - ROW of ROWs |
Add support for the {{ROW}} data type variables in stored routines according to this SQL Standard syntax:
{noformat} <row type> ::= ROW <row type body> <row type body> ::= <left paren> <field definition> [ { <comma> <field definition> }... ] <right paren> <field definition> ::= <field name> <data type> <data type> ::= <predefined type> {noformat} and add support for a new expression type, a ROW field reference, as follows: {noformat} <field reference> ::= <row variable> <period> <field name> {noformat} where {{<row variable>}} is a stored routine variable declared using {{<row type>}}. Example: {code:sql} DELIMITER $$ CREATE PROCEDURE p1() BEGIN DECLARE a ROW (c1 INT, c2 VARCHAR(10)); SET a.c1= 10; SET a.c2= 'test'; INSERT INTO t1 VALUES (a.c1, a.c2); END; $$ DELIMITER ; CALL p1(); {code} This task is needed to create infrastructure for MDEV-10593 This task is also needed as a prerequisite for {code:sql} FOR rec IN cursor {code} will automatically declare an index variable {{rec}} of the {{ROW}} data type, according to the cursor structure. h2. Row data type features: - Declaration of a ROW type stored routine variable (both local variables and parameters) - Declaration of a ROW type stored procedure OUT parameter - Default values in a ROW type variable declaration (e.g. {{DEFAULT ROW(1,2)}}) - Assignment of a ROW type variable from another ROW type variable (using the {{:=}} operator and the {{SET}} command) - Assignment of a ROW type variable from a ROW() function result (using the {{:=}} operator and the {{SET}} command) - Passing a ROW type variable and a {{ROW()}} function result to stored routines - Comparison of a ROW type variable to another ROW type variable - Comparison of a ROW type variable to ROW() function h2. Row field features: ROW fields (members) will act as normal variables, and will be able to appear in all query parts where an SP variable is allowed: - assignment (using the {{:=}} operator and the {{SET}} command) {code:sql} a.x:= 10; a.x:= b.x; SET a.x= 10, a.y=20, a.z= b.z; {code} - clauses: select list, {{WHERE}}, {{HAVING}}, {{LIMIT}}, etc {code:sql} SELECT var.a, t1.b FROM t1 WHERE t1.b=var.b LIMIT var.c; {code} - {{INSERT}} values {code:sql} INSERT INTO t1 VALUES (rec.a, rec.b, rec.c); {code} - {{SELECT .. INTO}} targets {code:sql} SELECT a,b INTO rec.a, rec.b FROM t1 WHERE t1.id=10; {code} - Dynamic SQL out parameters ({{EXECUTE}} and {{EXECUTE IMMEDIATE}}) {code:sql} EXECUTE IMMEDIATE 'CALL proc_with_out_param(?)' USING rec.a; {code} h2. Features not supported: The following features are out of scope of this task and will be implemented separately: - Returning a ROW type expression from a stored function. This will need some grammar change to support field names after parentheses: {code:sql} SELECT f1().x FROM DUAL; {code} - Returning a ROW type expression from a built-in hybrid type function, such as {{CASE}}, {{IF}}, etc. - ROW of ROWs |
Description |
Add support for the {{ROW}} data type variables in stored routines according to this SQL Standard syntax:
{noformat} <row type> ::= ROW <row type body> <row type body> ::= <left paren> <field definition> [ { <comma> <field definition> }... ] <right paren> <field definition> ::= <field name> <data type> <data type> ::= <predefined type> {noformat} and add support for a new expression type, a ROW field reference, as follows: {noformat} <field reference> ::= <row variable> <period> <field name> {noformat} where {{<row variable>}} is a stored routine variable declared using {{<row type>}}. Example: {code:sql} DELIMITER $$ CREATE PROCEDURE p1() BEGIN DECLARE a ROW (c1 INT, c2 VARCHAR(10)); SET a.c1= 10; SET a.c2= 'test'; INSERT INTO t1 VALUES (a.c1, a.c2); END; $$ DELIMITER ; CALL p1(); {code} This task is needed to create infrastructure for MDEV-10593 This task is also needed as a prerequisite for {code:sql} FOR rec IN cursor {code} will automatically declare an index variable {{rec}} of the {{ROW}} data type, according to the cursor structure. h2. Row data type features: - Declaration of a ROW type stored routine variable (both local variables and parameters) - Declaration of a ROW type stored procedure OUT parameter - Default values in a ROW type variable declaration (e.g. {{DEFAULT ROW(1,2)}}) - Assignment of a ROW type variable from another ROW type variable (using the {{:=}} operator and the {{SET}} command) - Assignment of a ROW type variable from a ROW() function result (using the {{:=}} operator and the {{SET}} command) - Passing a ROW type variable and a {{ROW()}} function result to stored routines - Comparison of a ROW type variable to another ROW type variable - Comparison of a ROW type variable to ROW() function h2. Row field features: ROW fields (members) will act as normal variables, and will be able to appear in all query parts where an SP variable is allowed: - assignment (using the {{:=}} operator and the {{SET}} command) {code:sql} a.x:= 10; a.x:= b.x; SET a.x= 10, a.y=20, a.z= b.z; {code} - clauses: select list, {{WHERE}}, {{HAVING}}, {{LIMIT}}, etc {code:sql} SELECT var.a, t1.b FROM t1 WHERE t1.b=var.b LIMIT var.c; {code} - {{INSERT}} values {code:sql} INSERT INTO t1 VALUES (rec.a, rec.b, rec.c); {code} - {{SELECT .. INTO}} targets {code:sql} SELECT a,b INTO rec.a, rec.b FROM t1 WHERE t1.id=10; {code} - Dynamic SQL out parameters ({{EXECUTE}} and {{EXECUTE IMMEDIATE}}) {code:sql} EXECUTE IMMEDIATE 'CALL proc_with_out_param(?)' USING rec.a; {code} h2. Features not supported: The following features are out of scope of this task and will be implemented separately: - Returning a ROW type expression from a stored function. This will need some grammar change to support field names after parentheses: {code:sql} SELECT f1().x FROM DUAL; {code} - Returning a ROW type expression from a built-in hybrid type function, such as {{CASE}}, {{IF}}, etc. - ROW of ROWs |
Add support for the {{ROW}} data type variables in stored routines according to this SQL Standard syntax:
{noformat} <row type> ::= ROW <row type body> <row type body> ::= <left paren> <field definition> [ { <comma> <field definition> }... ] <right paren> <field definition> ::= <field name> <data type> <data type> ::= <predefined type> {noformat} and add support for a new expression type, a ROW field reference, as follows: {noformat} <field reference> ::= <row variable> <period> <field name> {noformat} where {{<row variable>}} is a stored routine variable declared using {{<row type>}}. Example: {code:sql} DELIMITER $$ CREATE PROCEDURE p1() BEGIN DECLARE a ROW (c1 INT, c2 VARCHAR(10)); SET a.c1= 10; SET a.c2= 'test'; INSERT INTO t1 VALUES (a.c1, a.c2); END; $$ DELIMITER ; CALL p1(); {code} This task is needed to create infrastructure for MDEV-10593 This task is also needed as a prerequisite for {code:sql} FOR rec IN cursor {code} will automatically declare an index variable {{rec}} of the {{ROW}} data type, according to the cursor structure. h2. Row data type features: - Declaration of a ROW type stored routine variable (both local variables and parameters) - Declaration of a ROW type stored procedure OUT parameter - Default values in a ROW type variable declaration (e.g. {{DEFAULT ROW(1,2)}}) - Assignment of a ROW type variable from another ROW type variable (using the {{:=}} operator and the {{SET}} command) - Assignment of a ROW type variable from a ROW() function result (using the {{:=}} operator and the {{SET}} command) - Passing a ROW type variable and a {{ROW()}} function result to stored routines - Comparison of a ROW type variable to another ROW type variable - Comparison of a ROW type variable to ROW() function h2. Row field features: ROW fields (members) will act as normal variables, and will be able to appear in all query parts where an SP variable is allowed: - assignment (using the {{:=}} operator and the {{SET}} command) {code:sql} a.x:= 10; a.x:= b.x; SET a.x= 10, a.y=20, a.z= b.z; {code} - passing to functions and operators {code:sql} SELECT f1(rec.a), rec.a<10; {code} - clauses: select list, {{WHERE}}, {{HAVING}}, {{LIMIT}}, etc {code:sql} SELECT var.a, t1.b FROM t1 WHERE t1.b=var.b LIMIT var.c; {code} - {{INSERT}} values {code:sql} INSERT INTO t1 VALUES (rec.a, rec.b, rec.c); {code} - {{SELECT .. INTO}} targets {code:sql} SELECT a,b INTO rec.a, rec.b FROM t1 WHERE t1.id=10; {code} - Dynamic SQL out parameters ({{EXECUTE}} and {{EXECUTE IMMEDIATE}}) {code:sql} EXECUTE IMMEDIATE 'CALL proc_with_out_param(?)' USING rec.a; {code} h2. Features not supported: The following features are out of scope of this task and will be implemented separately: - Returning a ROW type expression from a stored function. This will need some grammar change to support field names after parentheses: {code:sql} SELECT f1().x FROM DUAL; {code} - Returning a ROW type expression from a built-in hybrid type function, such as {{CASE}}, {{IF}}, etc. - ROW of ROWs |
Status | Open [ 1 ] | In Progress [ 3 ] |
Assignee | Alexander Barkov [ bar ] | Michael Widenius [ monty ] |
Status | In Progress [ 3 ] | In Review [ 10002 ] |
Labels | Compatibility |
Labels | Compatibility | Compatibility NRE-307517 |
Link |
This issue is blocked by |
Link | This issue relates to MDEV-11210 [ MDEV-11210 ] |
Description |
Add support for the {{ROW}} data type variables in stored routines according to this SQL Standard syntax:
{noformat} <row type> ::= ROW <row type body> <row type body> ::= <left paren> <field definition> [ { <comma> <field definition> }... ] <right paren> <field definition> ::= <field name> <data type> <data type> ::= <predefined type> {noformat} and add support for a new expression type, a ROW field reference, as follows: {noformat} <field reference> ::= <row variable> <period> <field name> {noformat} where {{<row variable>}} is a stored routine variable declared using {{<row type>}}. Example: {code:sql} DELIMITER $$ CREATE PROCEDURE p1() BEGIN DECLARE a ROW (c1 INT, c2 VARCHAR(10)); SET a.c1= 10; SET a.c2= 'test'; INSERT INTO t1 VALUES (a.c1, a.c2); END; $$ DELIMITER ; CALL p1(); {code} This task is needed to create infrastructure for MDEV-10593 This task is also needed as a prerequisite for {code:sql} FOR rec IN cursor {code} will automatically declare an index variable {{rec}} of the {{ROW}} data type, according to the cursor structure. h2. Row data type features: - Declaration of a ROW type stored routine variable (both local variables and parameters) - Declaration of a ROW type stored procedure OUT parameter - Default values in a ROW type variable declaration (e.g. {{DEFAULT ROW(1,2)}}) - Assignment of a ROW type variable from another ROW type variable (using the {{:=}} operator and the {{SET}} command) - Assignment of a ROW type variable from a ROW() function result (using the {{:=}} operator and the {{SET}} command) - Passing a ROW type variable and a {{ROW()}} function result to stored routines - Comparison of a ROW type variable to another ROW type variable - Comparison of a ROW type variable to ROW() function h2. Row field features: ROW fields (members) will act as normal variables, and will be able to appear in all query parts where an SP variable is allowed: - assignment (using the {{:=}} operator and the {{SET}} command) {code:sql} a.x:= 10; a.x:= b.x; SET a.x= 10, a.y=20, a.z= b.z; {code} - passing to functions and operators {code:sql} SELECT f1(rec.a), rec.a<10; {code} - clauses: select list, {{WHERE}}, {{HAVING}}, {{LIMIT}}, etc {code:sql} SELECT var.a, t1.b FROM t1 WHERE t1.b=var.b LIMIT var.c; {code} - {{INSERT}} values {code:sql} INSERT INTO t1 VALUES (rec.a, rec.b, rec.c); {code} - {{SELECT .. INTO}} targets {code:sql} SELECT a,b INTO rec.a, rec.b FROM t1 WHERE t1.id=10; {code} - Dynamic SQL out parameters ({{EXECUTE}} and {{EXECUTE IMMEDIATE}}) {code:sql} EXECUTE IMMEDIATE 'CALL proc_with_out_param(?)' USING rec.a; {code} h2. Features not supported: The following features are out of scope of this task and will be implemented separately: - Returning a ROW type expression from a stored function. This will need some grammar change to support field names after parentheses: {code:sql} SELECT f1().x FROM DUAL; {code} - Returning a ROW type expression from a built-in hybrid type function, such as {{CASE}}, {{IF}}, etc. - ROW of ROWs |
Add support for the {{ROW}} data type variables in stored routines according to this SQL Standard syntax:
{noformat} <row type> ::= ROW <row type body> <row type body> ::= <left paren> <field definition> [ { <comma> <field definition> }... ] <right paren> <field definition> ::= <field name> <data type> <data type> ::= <predefined type> {noformat} and add support for a new expression type, a ROW field reference, as follows: {noformat} <field reference> ::= <row variable> <period> <field name> {noformat} where {{<row variable>}} is a stored routine variable declared using {{<row type>}}. Example: {code:sql} DELIMITER $$ CREATE PROCEDURE p1() BEGIN DECLARE a ROW (c1 INT, c2 VARCHAR(10)); SET a.c1= 10; SET a.c2= 'test'; INSERT INTO t1 VALUES (a.c1, a.c2); END; $$ DELIMITER ; CALL p1(); {code} This task is needed to create infrastructure for MDEV-10593 This task is also needed as a prerequisite for {code:sql} FOR rec IN cursor {code} will automatically declare an index variable {{rec}} of the {{ROW}} data type, according to the cursor structure. h2. Row data type features: - Declaration of a ROW type stored routine variable (both local variables and parameters) - Declaration of a ROW type stored procedure OUT parameter - Default values in a ROW type variable declaration (e.g. {{DEFAULT ROW(1,2)}}) - Assignment of a ROW type variable from another ROW type variable (using the {{:=}} operator and the {{SET}} command) - Assignment of a ROW type variable from a ROW() function result (using the {{:=}} operator and the {{SET}} command) - Passing a ROW type variable and a {{ROW()}} function result to stored routines - Comparison of a ROW type variable to another ROW type variable - Comparison of a ROW type variable to ROW() function h2. Row field features: ROW fields (members) will act as normal variables, and will be able to appear in all query parts where an SP variable is allowed: - assignment (using the {{:=}} operator and the {{SET}} command) {code:sql} a.x:= 10; a.x:= b.x; SET a.x= 10, a.y=20, a.z= b.z; {code} - passing to functions and operators {code:sql} SELECT f1(rec.a), rec.a<10; {code} - clauses: select list, {{WHERE}}, {{HAVING}}, {{LIMIT}}, etc {code:sql} SELECT var.a, t1.b FROM t1 WHERE t1.b=var.b LIMIT var.c; {code} - {{INSERT}} values {code:sql} INSERT INTO t1 VALUES (rec.a, rec.b, rec.c); {code} - {{SELECT .. INTO}} targets {code:sql} SELECT a,b INTO rec.a, rec.b FROM t1 WHERE t1.id=10; {code} - Dynamic SQL out parameters ({{EXECUTE}} and {{EXECUTE IMMEDIATE}}) {code:sql} EXECUTE IMMEDIATE 'CALL proc_with_out_param(?)' USING rec.a; {code} h2. Features not supported: The following features are out of scope of this task and will be implemented separately (see MDEV-11210): - Returning a ROW type expression from a stored function. This will need some grammar change to support field names after parentheses: {code:sql} SELECT f1().x FROM DUAL; {code} - Returning a ROW type expression from a built-in hybrid type function, such as {{CASE}}, {{IF}}, etc. - ROW of ROWs |
Description |
Add support for the {{ROW}} data type variables in stored routines according to this SQL Standard syntax:
{noformat} <row type> ::= ROW <row type body> <row type body> ::= <left paren> <field definition> [ { <comma> <field definition> }... ] <right paren> <field definition> ::= <field name> <data type> <data type> ::= <predefined type> {noformat} and add support for a new expression type, a ROW field reference, as follows: {noformat} <field reference> ::= <row variable> <period> <field name> {noformat} where {{<row variable>}} is a stored routine variable declared using {{<row type>}}. Example: {code:sql} DELIMITER $$ CREATE PROCEDURE p1() BEGIN DECLARE a ROW (c1 INT, c2 VARCHAR(10)); SET a.c1= 10; SET a.c2= 'test'; INSERT INTO t1 VALUES (a.c1, a.c2); END; $$ DELIMITER ; CALL p1(); {code} This task is needed to create infrastructure for MDEV-10593 This task is also needed as a prerequisite for {code:sql} FOR rec IN cursor {code} will automatically declare an index variable {{rec}} of the {{ROW}} data type, according to the cursor structure. h2. Row data type features: - Declaration of a ROW type stored routine variable (both local variables and parameters) - Declaration of a ROW type stored procedure OUT parameter - Default values in a ROW type variable declaration (e.g. {{DEFAULT ROW(1,2)}}) - Assignment of a ROW type variable from another ROW type variable (using the {{:=}} operator and the {{SET}} command) - Assignment of a ROW type variable from a ROW() function result (using the {{:=}} operator and the {{SET}} command) - Passing a ROW type variable and a {{ROW()}} function result to stored routines - Comparison of a ROW type variable to another ROW type variable - Comparison of a ROW type variable to ROW() function h2. Row field features: ROW fields (members) will act as normal variables, and will be able to appear in all query parts where an SP variable is allowed: - assignment (using the {{:=}} operator and the {{SET}} command) {code:sql} a.x:= 10; a.x:= b.x; SET a.x= 10, a.y=20, a.z= b.z; {code} - passing to functions and operators {code:sql} SELECT f1(rec.a), rec.a<10; {code} - clauses: select list, {{WHERE}}, {{HAVING}}, {{LIMIT}}, etc {code:sql} SELECT var.a, t1.b FROM t1 WHERE t1.b=var.b LIMIT var.c; {code} - {{INSERT}} values {code:sql} INSERT INTO t1 VALUES (rec.a, rec.b, rec.c); {code} - {{SELECT .. INTO}} targets {code:sql} SELECT a,b INTO rec.a, rec.b FROM t1 WHERE t1.id=10; {code} - Dynamic SQL out parameters ({{EXECUTE}} and {{EXECUTE IMMEDIATE}}) {code:sql} EXECUTE IMMEDIATE 'CALL proc_with_out_param(?)' USING rec.a; {code} h2. Features not supported: The following features are out of scope of this task and will be implemented separately (see MDEV-11210): - Returning a ROW type expression from a stored function. This will need some grammar change to support field names after parentheses: {code:sql} SELECT f1().x FROM DUAL; {code} - Returning a ROW type expression from a built-in hybrid type function, such as {{CASE}}, {{IF}}, etc. - ROW of ROWs |
Add support for the {{ROW}} data type variables in stored routines according to this SQL Standard syntax:
{noformat} <row type> ::= ROW <row type body> <row type body> ::= <left paren> <field definition> [ { <comma> <field definition> }... ] <right paren> <field definition> ::= <field name> <data type> <data type> ::= <predefined type> {noformat} and add support for a new expression type, a ROW field reference, as follows: {noformat} <field reference> ::= <row variable> <period> <field name> {noformat} where {{<row variable>}} is a stored routine variable declared using {{<row type>}}. Example: {code:sql} DELIMITER $$ CREATE PROCEDURE p1() BEGIN DECLARE a ROW (c1 INT, c2 VARCHAR(10)); SET a.c1= 10; SET a.c2= 'test'; INSERT INTO t1 VALUES (a.c1, a.c2); END; $$ DELIMITER ; CALL p1(); {code} This task is needed to create infrastructure for MDEV-10593 This task is also needed as a prerequisite for {code:sql} FOR rec IN cursor {code} will automatically declare an index variable {{rec}} of the {{ROW}} data type, according to the cursor structure. h2. Row data type features: - Declaration of a ROW type stored routine variable (both local variables and parameters) - Declaration of a ROW type stored procedure OUT parameter - Default values in a ROW type variable declaration (e.g. {{DEFAULT ROW(1,2)}}) - Assignment of a ROW type variable from another ROW type variable (using the {{:=}} operator and the {{SET}} command) - Assignment of a ROW type variable from a ROW() function result (using the {{:=}} operator and the {{SET}} command) - Passing a ROW type variable and a {{ROW()}} function result to stored routines - Comparison of a ROW type variable to another ROW type variable - Comparison of a ROW type variable to ROW() function h2. Row field features: ROW fields (members) will act as normal variables, and will be able to appear in all query parts where an SP variable is allowed: - assignment (using the {{:=}} operator and the {{SET}} command) {code:sql} a.x:= 10; a.x:= b.x; SET a.x= 10, a.y=20, a.z= b.z; {code} - passing to functions and operators {code:sql} SELECT f1(rec.a), rec.a<10; {code} - clauses: select list, {{WHERE}}, {{HAVING}}, {{LIMIT}}, etc {code:sql} SELECT var.a, t1.b FROM t1 WHERE t1.b=var.b LIMIT var.c; {code} - {{INSERT}} values {code:sql} INSERT INTO t1 VALUES (rec.a, rec.b, rec.c); {code} - {{SELECT .. INTO}} targets {code:sql} SELECT a,b INTO rec.a, rec.b FROM t1 WHERE t1.id=10; {code} - Dynamic SQL out parameters ({{EXECUTE}} and {{EXECUTE IMMEDIATE}}) {code:sql} EXECUTE IMMEDIATE 'CALL proc_with_out_param(?)' USING rec.a; {code} h2. Features not supported: The following features are out of scope of this task and will be implemented separately: - Returning a ROW type expression from a stored function (see MDEV-11210). This will need some grammar change to support field names after parentheses: {code:sql} SELECT f1().x FROM DUAL; {code} - Returning a ROW type expression from a built-in hybrid type function, such as {{CASE}}, {{IF}}, etc. - ROW of ROWs |
NRE Projects | NRE-307517 |
Labels | Compatibility NRE-307517 | Compatibility |
Assignee | Michael Widenius [ monty ] | Alexander Barkov [ bar ] |
Status | In Review [ 10002 ] | Stalled [ 10000 ] |
Fix Version/s | 10.3.0 [ 22127 ] | |
Fix Version/s | 10.3 [ 22126 ] | |
Resolution | Fixed [ 1 ] | |
Status | Stalled [ 10000 ] | Closed [ 6 ] |
Description |
Add support for the {{ROW}} data type variables in stored routines according to this SQL Standard syntax:
{noformat} <row type> ::= ROW <row type body> <row type body> ::= <left paren> <field definition> [ { <comma> <field definition> }... ] <right paren> <field definition> ::= <field name> <data type> <data type> ::= <predefined type> {noformat} and add support for a new expression type, a ROW field reference, as follows: {noformat} <field reference> ::= <row variable> <period> <field name> {noformat} where {{<row variable>}} is a stored routine variable declared using {{<row type>}}. Example: {code:sql} DELIMITER $$ CREATE PROCEDURE p1() BEGIN DECLARE a ROW (c1 INT, c2 VARCHAR(10)); SET a.c1= 10; SET a.c2= 'test'; INSERT INTO t1 VALUES (a.c1, a.c2); END; $$ DELIMITER ; CALL p1(); {code} This task is needed to create infrastructure for MDEV-10593 This task is also needed as a prerequisite for {code:sql} FOR rec IN cursor {code} will automatically declare an index variable {{rec}} of the {{ROW}} data type, according to the cursor structure. h2. Row data type features: - Declaration of a ROW type stored routine variable (both local variables and parameters) - Declaration of a ROW type stored procedure OUT parameter - Default values in a ROW type variable declaration (e.g. {{DEFAULT ROW(1,2)}}) - Assignment of a ROW type variable from another ROW type variable (using the {{:=}} operator and the {{SET}} command) - Assignment of a ROW type variable from a ROW() function result (using the {{:=}} operator and the {{SET}} command) - Passing a ROW type variable and a {{ROW()}} function result to stored routines - Comparison of a ROW type variable to another ROW type variable - Comparison of a ROW type variable to ROW() function h2. Row field features: ROW fields (members) will act as normal variables, and will be able to appear in all query parts where an SP variable is allowed: - assignment (using the {{:=}} operator and the {{SET}} command) {code:sql} a.x:= 10; a.x:= b.x; SET a.x= 10, a.y=20, a.z= b.z; {code} - passing to functions and operators {code:sql} SELECT f1(rec.a), rec.a<10; {code} - clauses: select list, {{WHERE}}, {{HAVING}}, {{LIMIT}}, etc {code:sql} SELECT var.a, t1.b FROM t1 WHERE t1.b=var.b LIMIT var.c; {code} - {{INSERT}} values {code:sql} INSERT INTO t1 VALUES (rec.a, rec.b, rec.c); {code} - {{SELECT .. INTO}} targets {code:sql} SELECT a,b INTO rec.a, rec.b FROM t1 WHERE t1.id=10; {code} - Dynamic SQL out parameters ({{EXECUTE}} and {{EXECUTE IMMEDIATE}}) {code:sql} EXECUTE IMMEDIATE 'CALL proc_with_out_param(?)' USING rec.a; {code} h2. Features not supported: The following features are out of scope of this task and will be implemented separately: - Returning a ROW type expression from a stored function (see MDEV-11210). This will need some grammar change to support field names after parentheses: {code:sql} SELECT f1().x FROM DUAL; {code} - Returning a ROW type expression from a built-in hybrid type function, such as {{CASE}}, {{IF}}, etc. - ROW of ROWs |
Add support for the {{ROW}} data type variables in stored routines according to this SQL Standard syntax:
{noformat} <row type> ::= ROW <row type body> <row type body> ::= <left paren> <field definition> [ { <comma> <field definition> }... ] <right paren> <field definition> ::= <field name> <data type> <data type> ::= <predefined type> {noformat} and add support for a new expression type, a ROW field reference, as follows: {noformat} <field reference> ::= <row variable> <period> <field name> {noformat} where {{<row variable>}} is a stored routine variable declared using {{<row type>}}. Example: {code:sql} DELIMITER $$ CREATE PROCEDURE p1() BEGIN DECLARE a ROW (c1 INT, c2 VARCHAR(10)); SET a.c1= 10; SET a.c2= 'test'; INSERT INTO t1 VALUES (a.c1, a.c2); END; $$ DELIMITER ; CALL p1(); {code} This task is needed to create infrastructure for MDEV-10593 This task is also needed as a prerequisite for {code:sql} FOR rec IN cursor {code} will automatically declare an index variable {{rec}} of the {{ROW}} data type, according to the cursor structure. h2. Row data type features: - Declaration of a ROW type stored routine variable (both local variables and parameters) - Declaration of a ROW type stored procedure OUT parameter - Default values in a ROW type variable declaration (e.g. {{DEFAULT ROW(1,2)}}) - Assignment of a ROW type variable from another ROW type variable (using the {{:=}} operator and the {{SET}} command) - Assignment of a ROW type variable from a ROW() function result (using the {{:=}} operator and the {{SET}} command) - Passing a ROW type variable and a {{ROW()}} function result to stored routines - Comparison of a ROW type variable to another ROW type variable - Comparison of a ROW type variable to ROW() function h2. Row field features: ROW fields (members) will act as normal variables, and will be able to appear in all query parts where an SP variable is allowed: - assignment (using the {{:=}} operator and the {{SET}} command) {code:sql} a.x:= 10; a.x:= b.x; SET a.x= 10, a.y=20, a.z= b.z; {code} - passing to functions and operators {code:sql} SELECT f1(rec.a), rec.a<10; {code} - clauses: select list, {{WHERE}}, {{HAVING}}, {{LIMIT}}, etc {code:sql} SELECT var.a, t1.b FROM t1 WHERE t1.b=var.b LIMIT var.c; {code} - {{INSERT}} values {code:sql} INSERT INTO t1 VALUES (rec.a, rec.b, rec.c); {code} - {{SELECT .. INTO}} targets {code:sql} SELECT a,b INTO rec.a, rec.b FROM t1 WHERE t1.id=10; {code} - Dynamic SQL out parameters ({{EXECUTE}} and {{EXECUTE IMMEDIATE}}) {code:sql} EXECUTE IMMEDIATE 'CALL proc_with_out_param(?)' USING rec.a; {code} h2. Features not supported: The following features are out of scope of this task and will be implemented separately: - Returning a ROW type expression from a stored function (see {code:sql} SELECT f1().x FROM DUAL; {code} - Returning a ROW type expression from a built-in hybrid type function, such as {{CASE}}, {{IF}}, etc. - ROW of ROWs |
Link |
This issue blocks |
Component/s | Stored routines [ 13905 ] |
Description |
Add support for the {{ROW}} data type variables in stored routines according to this SQL Standard syntax:
{noformat} <row type> ::= ROW <row type body> <row type body> ::= <left paren> <field definition> [ { <comma> <field definition> }... ] <right paren> <field definition> ::= <field name> <data type> <data type> ::= <predefined type> {noformat} and add support for a new expression type, a ROW field reference, as follows: {noformat} <field reference> ::= <row variable> <period> <field name> {noformat} where {{<row variable>}} is a stored routine variable declared using {{<row type>}}. Example: {code:sql} DELIMITER $$ CREATE PROCEDURE p1() BEGIN DECLARE a ROW (c1 INT, c2 VARCHAR(10)); SET a.c1= 10; SET a.c2= 'test'; INSERT INTO t1 VALUES (a.c1, a.c2); END; $$ DELIMITER ; CALL p1(); {code} This task is needed to create infrastructure for MDEV-10593 This task is also needed as a prerequisite for {code:sql} FOR rec IN cursor {code} will automatically declare an index variable {{rec}} of the {{ROW}} data type, according to the cursor structure. h2. Row data type features: - Declaration of a ROW type stored routine variable (both local variables and parameters) - Declaration of a ROW type stored procedure OUT parameter - Default values in a ROW type variable declaration (e.g. {{DEFAULT ROW(1,2)}}) - Assignment of a ROW type variable from another ROW type variable (using the {{:=}} operator and the {{SET}} command) - Assignment of a ROW type variable from a ROW() function result (using the {{:=}} operator and the {{SET}} command) - Passing a ROW type variable and a {{ROW()}} function result to stored routines - Comparison of a ROW type variable to another ROW type variable - Comparison of a ROW type variable to ROW() function h2. Row field features: ROW fields (members) will act as normal variables, and will be able to appear in all query parts where an SP variable is allowed: - assignment (using the {{:=}} operator and the {{SET}} command) {code:sql} a.x:= 10; a.x:= b.x; SET a.x= 10, a.y=20, a.z= b.z; {code} - passing to functions and operators {code:sql} SELECT f1(rec.a), rec.a<10; {code} - clauses: select list, {{WHERE}}, {{HAVING}}, {{LIMIT}}, etc {code:sql} SELECT var.a, t1.b FROM t1 WHERE t1.b=var.b LIMIT var.c; {code} - {{INSERT}} values {code:sql} INSERT INTO t1 VALUES (rec.a, rec.b, rec.c); {code} - {{SELECT .. INTO}} targets {code:sql} SELECT a,b INTO rec.a, rec.b FROM t1 WHERE t1.id=10; {code} - Dynamic SQL out parameters ({{EXECUTE}} and {{EXECUTE IMMEDIATE}}) {code:sql} EXECUTE IMMEDIATE 'CALL proc_with_out_param(?)' USING rec.a; {code} h2. Features not supported: The following features are out of scope of this task and will be implemented separately: - Returning a ROW type expression from a stored function (see {code:sql} SELECT f1().x FROM DUAL; {code} - Returning a ROW type expression from a built-in hybrid type function, such as {{CASE}}, {{IF}}, etc. - ROW of ROWs |
Add support for the {{ROW}} data type variables in stored routines according to this SQL Standard syntax:
{noformat} <row type> ::= ROW <row type body> <row type body> ::= <left paren> <field definition> [ { <comma> <field definition> }... ] <right paren> <field definition> ::= <field name> <data type> <data type> ::= <predefined type> {noformat} and add support for a new expression type, a ROW field reference, as follows: {noformat} <field reference> ::= <row variable> <period> <field name> {noformat} where {{<row variable>}} is a stored routine variable declared using {{<row type>}}. Example: {code:sql} DELIMITER $$ CREATE PROCEDURE p1() BEGIN DECLARE a ROW (c1 INT, c2 VARCHAR(10)); SET a.c1= 10; SET a.c2= 'test'; INSERT INTO t1 VALUES (a.c1, a.c2); END; $$ DELIMITER ; CALL p1(); {code} This task is needed to create infrastructure for MDEV-10593 This task is also needed as a prerequisite for {code:sql} FOR rec IN cursor {code} will automatically declare an index variable {{rec}} of the {{ROW}} data type, according to the cursor structure. h2. Row data type features: - Declaration of a ROW type stored routine variable (both local variables and parameters) - Declaration of a ROW type stored procedure OUT parameter - Default values in a ROW type variable declaration (e.g. {{DEFAULT ROW(1,2)}}) - Assignment of a ROW type variable from another ROW type variable (using the {{:=}} operator and the {{SET}} command) - Assignment of a ROW type variable from a ROW() function result (using the {{:=}} operator and the {{SET}} command) - Passing a ROW type variable and a {{ROW()}} function result to stored routines - Comparison of a ROW type variable to another ROW type variable - Comparison of a ROW type variable to ROW() function h2. Row field features: ROW fields (members) will act as normal variables, and will be able to appear in all query parts where an SP variable is allowed: - assignment (using the {{SET}} command) {code:sql} SET a.x= 10, a.y=20;, a.z= b.z; {code} - assignment ({{sql_mode=ORACLE}} specific syntax) {code:sql} a.x:= 10; a.x:= b.x; {code} - passing to functions and operators {code:sql} SELECT f1(rec.a), rec.a<10; {code} - clauses: select list, {{WHERE}}, {{HAVING}}, {{LIMIT}}, etc {code:sql} SELECT var.a, t1.b FROM t1 WHERE t1.b=var.b LIMIT var.c; {code} - {{INSERT}} values {code:sql} INSERT INTO t1 VALUES (rec.a, rec.b, rec.c); {code} - {{SELECT .. INTO}} targets {code:sql} SELECT a,b INTO rec.a, rec.b FROM t1 WHERE t1.id=10; {code} - Dynamic SQL out parameters ({{EXECUTE}} and {{EXECUTE IMMEDIATE}}) {code:sql} EXECUTE IMMEDIATE 'CALL proc_with_out_param(?)' USING rec.a; {code} h2. Features not supported: The following features are out of scope of this task and will be implemented separately: - Returning a ROW type expression from a stored function (see {code:sql} SELECT f1().x FROM DUAL; {code} - Returning a ROW type expression from a built-in hybrid type function, such as {{CASE}}, {{IF}}, etc. - ROW of ROWs |
Description |
Add support for the {{ROW}} data type variables in stored routines according to this SQL Standard syntax:
{noformat} <row type> ::= ROW <row type body> <row type body> ::= <left paren> <field definition> [ { <comma> <field definition> }... ] <right paren> <field definition> ::= <field name> <data type> <data type> ::= <predefined type> {noformat} and add support for a new expression type, a ROW field reference, as follows: {noformat} <field reference> ::= <row variable> <period> <field name> {noformat} where {{<row variable>}} is a stored routine variable declared using {{<row type>}}. Example: {code:sql} DELIMITER $$ CREATE PROCEDURE p1() BEGIN DECLARE a ROW (c1 INT, c2 VARCHAR(10)); SET a.c1= 10; SET a.c2= 'test'; INSERT INTO t1 VALUES (a.c1, a.c2); END; $$ DELIMITER ; CALL p1(); {code} This task is needed to create infrastructure for MDEV-10593 This task is also needed as a prerequisite for {code:sql} FOR rec IN cursor {code} will automatically declare an index variable {{rec}} of the {{ROW}} data type, according to the cursor structure. h2. Row data type features: - Declaration of a ROW type stored routine variable (both local variables and parameters) - Declaration of a ROW type stored procedure OUT parameter - Default values in a ROW type variable declaration (e.g. {{DEFAULT ROW(1,2)}}) - Assignment of a ROW type variable from another ROW type variable (using the {{:=}} operator and the {{SET}} command) - Assignment of a ROW type variable from a ROW() function result (using the {{:=}} operator and the {{SET}} command) - Passing a ROW type variable and a {{ROW()}} function result to stored routines - Comparison of a ROW type variable to another ROW type variable - Comparison of a ROW type variable to ROW() function h2. Row field features: ROW fields (members) will act as normal variables, and will be able to appear in all query parts where an SP variable is allowed: - assignment (using the {{SET}} command) {code:sql} SET a.x= 10, a.y=20;, a.z= b.z; {code} - assignment ({{sql_mode=ORACLE}} specific syntax) {code:sql} a.x:= 10; a.x:= b.x; {code} - passing to functions and operators {code:sql} SELECT f1(rec.a), rec.a<10; {code} - clauses: select list, {{WHERE}}, {{HAVING}}, {{LIMIT}}, etc {code:sql} SELECT var.a, t1.b FROM t1 WHERE t1.b=var.b LIMIT var.c; {code} - {{INSERT}} values {code:sql} INSERT INTO t1 VALUES (rec.a, rec.b, rec.c); {code} - {{SELECT .. INTO}} targets {code:sql} SELECT a,b INTO rec.a, rec.b FROM t1 WHERE t1.id=10; {code} - Dynamic SQL out parameters ({{EXECUTE}} and {{EXECUTE IMMEDIATE}}) {code:sql} EXECUTE IMMEDIATE 'CALL proc_with_out_param(?)' USING rec.a; {code} h2. Features not supported: The following features are out of scope of this task and will be implemented separately: - Returning a ROW type expression from a stored function (see {code:sql} SELECT f1().x FROM DUAL; {code} - Returning a ROW type expression from a built-in hybrid type function, such as {{CASE}}, {{IF}}, etc. - ROW of ROWs |
Add support for the {{ROW}} data type variables in stored routines according to this SQL Standard syntax:
{noformat} <row type> ::= ROW <row type body> <row type body> ::= <left paren> <field definition> [ { <comma> <field definition> }... ] <right paren> <field definition> ::= <field name> <data type> <data type> ::= <predefined type> {noformat} and add support for a new expression type, a ROW field reference, as follows: {noformat} <field reference> ::= <row variable> <period> <field name> {noformat} where {{<row variable>}} is a stored routine variable declared using {{<row type>}}. Example: {code:sql} DELIMITER $$ CREATE PROCEDURE p1() BEGIN DECLARE a ROW (c1 INT, c2 VARCHAR(10)); SET a.c1= 10; SET a.c2= 'test'; INSERT INTO t1 VALUES (a.c1, a.c2); END; $$ DELIMITER ; CALL p1(); {code} This task is needed to create infrastructure for MDEV-10593 This task is also needed as a prerequisite for {code:sql} FOR rec IN cursor {code} will automatically declare an index variable {{rec}} of the {{ROW}} data type, according to the cursor structure. h2. Row data type features: - Declaration of a ROW type stored routine variable (both local variables and parameters) - Declaration of a ROW type stored procedure OUT parameter - Default values in a ROW type variable declaration (e.g. {{DEFAULT ROW(1,2)}}) - Assignment of a ROW type variable from another ROW type variable (using the {{:=}} operator and the {{SET}} command) - Assignment of a ROW type variable from a ROW() function result (using the {{:=}} operator and the {{SET}} command) - Passing a ROW type variable and a {{ROW()}} function result to stored routines - Comparison of a ROW type variable to another ROW type variable - Comparison of a ROW type variable to ROW() function h2. Row field features: ROW fields (members) will act as normal variables, and will be able to appear in all query parts where an SP variable is allowed: - assignment (using the {{SET}} command) {code:sql} SET a.x= 10, a.y=20, a.z= b.z; {code} - assignment ({{sql_mode=ORACLE}} specific syntax) {code:sql} a.x:= 10; a.x:= b.x; {code} - passing to functions and operators {code:sql} SELECT f1(rec.a), rec.a<10; {code} - clauses: select list, {{WHERE}}, {{HAVING}}, {{LIMIT}}, etc {code:sql} SELECT var.a, t1.b FROM t1 WHERE t1.b=var.b LIMIT var.c; {code} - {{INSERT}} values {code:sql} INSERT INTO t1 VALUES (rec.a, rec.b, rec.c); {code} - {{SELECT .. INTO}} targets {code:sql} SELECT a,b INTO rec.a, rec.b FROM t1 WHERE t1.id=10; {code} - Dynamic SQL out parameters ({{EXECUTE}} and {{EXECUTE IMMEDIATE}}) {code:sql} EXECUTE IMMEDIATE 'CALL proc_with_out_param(?)' USING rec.a; {code} h2. Features not supported: The following features are out of scope of this task and will be implemented separately: - Returning a ROW type expression from a stored function (see {code:sql} SELECT f1().x FROM DUAL; {code} - Returning a ROW type expression from a built-in hybrid type function, such as {{CASE}}, {{IF}}, etc. - ROW of ROWs |
Description |
Add support for the {{ROW}} data type variables in stored routines according to this SQL Standard syntax:
{noformat} <row type> ::= ROW <row type body> <row type body> ::= <left paren> <field definition> [ { <comma> <field definition> }... ] <right paren> <field definition> ::= <field name> <data type> <data type> ::= <predefined type> {noformat} and add support for a new expression type, a ROW field reference, as follows: {noformat} <field reference> ::= <row variable> <period> <field name> {noformat} where {{<row variable>}} is a stored routine variable declared using {{<row type>}}. Example: {code:sql} DELIMITER $$ CREATE PROCEDURE p1() BEGIN DECLARE a ROW (c1 INT, c2 VARCHAR(10)); SET a.c1= 10; SET a.c2= 'test'; INSERT INTO t1 VALUES (a.c1, a.c2); END; $$ DELIMITER ; CALL p1(); {code} This task is needed to create infrastructure for MDEV-10593 This task is also needed as a prerequisite for {code:sql} FOR rec IN cursor {code} will automatically declare an index variable {{rec}} of the {{ROW}} data type, according to the cursor structure. h2. Row data type features: - Declaration of a ROW type stored routine variable (both local variables and parameters) - Declaration of a ROW type stored procedure OUT parameter - Default values in a ROW type variable declaration (e.g. {{DEFAULT ROW(1,2)}}) - Assignment of a ROW type variable from another ROW type variable (using the {{:=}} operator and the {{SET}} command) - Assignment of a ROW type variable from a ROW() function result (using the {{:=}} operator and the {{SET}} command) - Passing a ROW type variable and a {{ROW()}} function result to stored routines - Comparison of a ROW type variable to another ROW type variable - Comparison of a ROW type variable to ROW() function h2. Row field features: ROW fields (members) will act as normal variables, and will be able to appear in all query parts where an SP variable is allowed: - assignment (using the {{SET}} command) {code:sql} SET a.x= 10, a.y=20, a.z= b.z; {code} - assignment ({{sql_mode=ORACLE}} specific syntax) {code:sql} a.x:= 10; a.x:= b.x; {code} - passing to functions and operators {code:sql} SELECT f1(rec.a), rec.a<10; {code} - clauses: select list, {{WHERE}}, {{HAVING}}, {{LIMIT}}, etc {code:sql} SELECT var.a, t1.b FROM t1 WHERE t1.b=var.b LIMIT var.c; {code} - {{INSERT}} values {code:sql} INSERT INTO t1 VALUES (rec.a, rec.b, rec.c); {code} - {{SELECT .. INTO}} targets {code:sql} SELECT a,b INTO rec.a, rec.b FROM t1 WHERE t1.id=10; {code} - Dynamic SQL out parameters ({{EXECUTE}} and {{EXECUTE IMMEDIATE}}) {code:sql} EXECUTE IMMEDIATE 'CALL proc_with_out_param(?)' USING rec.a; {code} h2. Features not supported: The following features are out of scope of this task and will be implemented separately: - Returning a ROW type expression from a stored function (see {code:sql} SELECT f1().x FROM DUAL; {code} - Returning a ROW type expression from a built-in hybrid type function, such as {{CASE}}, {{IF}}, etc. - ROW of ROWs |
Add support for the {{ROW}} data type variables in stored routines according to this SQL Standard syntax:
{noformat} <row type> ::= ROW <row type body> <row type body> ::= <left paren> <field definition> [ { <comma> <field definition> }... ] <right paren> <field definition> ::= <field name> <data type> <data type> ::= <predefined type> {noformat} and add support for a new expression type, a ROW field reference, as follows: {noformat} <field reference> ::= <row variable> <period> <field name> {noformat} where {{<row variable>}} is a stored routine variable declared using {{<row type>}}. Example: {code:sql} DELIMITER $$ CREATE PROCEDURE p1() BEGIN DECLARE a ROW (c1 INT, c2 VARCHAR(10)); SET a.c1= 10; SET a.c2= 'test'; INSERT INTO t1 VALUES (a.c1, a.c2); END; $$ DELIMITER ; CALL p1(); {code} This task is needed to create infrastructure for MDEV-10593 This task is also needed as a prerequisite for {code:sql} FOR rec IN cursor {code} will automatically declare an index variable {{rec}} of the {{ROW}} data type, according to the cursor structure. h2. Row data type features: - Declaration of a ROW type stored routine variable (both local variables and parameters) - Declaration of a ROW type stored procedure OUT parameter - Default values in a ROW type variable declaration (e.g. {{DEFAULT ROW(1,2)}}) - Assignment of a ROW type variable from another ROW type variable (using the {{SET}} command and the {{:=}} operator in {{sql_mode=ORACLE}}) - Assignment of a ROW type variable from a ROW() function result (using the {{SET}} command and the {{:=}} operator in {{sql_mode=ORACLE}}) - Passing a ROW type variable and a {{ROW()}} function result to stored routines - Comparison of a ROW type variable to another ROW type variable - Comparison of a ROW type variable to ROW() function h2. Row field features: ROW fields (members) will act as normal variables, and will be able to appear in all query parts where an SP variable is allowed: - assignment (using the {{SET}} command) {code:sql} SET a.x= 10, a.y=20, a.z= b.z; {code} - assignment ({{sql_mode=ORACLE}} specific syntax) {code:sql} a.x:= 10; a.x:= b.x; {code} - passing to functions and operators {code:sql} SELECT f1(rec.a), rec.a<10; {code} - clauses: select list, {{WHERE}}, {{HAVING}}, {{LIMIT}}, etc {code:sql} SELECT var.a, t1.b FROM t1 WHERE t1.b=var.b LIMIT var.c; {code} - {{INSERT}} values {code:sql} INSERT INTO t1 VALUES (rec.a, rec.b, rec.c); {code} - {{SELECT .. INTO}} targets {code:sql} SELECT a,b INTO rec.a, rec.b FROM t1 WHERE t1.id=10; {code} - Dynamic SQL out parameters ({{EXECUTE}} and {{EXECUTE IMMEDIATE}}) {code:sql} EXECUTE IMMEDIATE 'CALL proc_with_out_param(?)' USING rec.a; {code} h2. Features not supported: The following features are out of scope of this task and will be implemented separately: - Returning a ROW type expression from a stored function (see {code:sql} SELECT f1().x FROM DUAL; {code} - Returning a ROW type expression from a built-in hybrid type function, such as {{CASE}}, {{IF}}, etc. - ROW of ROWs |
Link |
This issue relates to |
Link |
This issue blocks |
Link |
This issue blocks |
Workflow | MariaDB v3 [ 77598 ] | MariaDB v4 [ 150977 ] |
Link |
This issue relates to |
Link | This issue is blocked by MDEV-32380 [ MDEV-32380 ] |
Link | This issue relates to MDEV-32380 [ MDEV-32380 ] |
Link | This issue is blocked by MDEV-32380 [ MDEV-32380 ] |
Approved by Monty.