<div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Apr 3, 2020 at 8:22 PM Nikita Pettik <<a href="mailto:korablev@tarantool.org">korablev@tarantool.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
+execute(s.stmt_id, {{[':a'] = 1}, {[':b'] = 2}});<br>
+ | ---<br>
+ | - metadata:<br>
+ | - name: :a<br>
+ | type: integer<br>
+ | - name: :b<br>
+ | type: integer<br>
+ | - name: :c<br>
+ | type: boolean<br>
+ | rows:<br>
+ | - [1, 2, null]<br></blockquote><div><br></div><div>I wonder, shouldn't an error be thrown if there are not enough parameters passed? <br></div><div>I just checked Postgres and MySQL, optional parameters are forbidden on both systems:</div><div><br></div><div>Postgres</div><div>------------------------------------------------------------------------------------------<br></div><div>PREPARE foo (int, int, int) AS SELECT $1, $2, $3;<br>EXECUTE foo(1, 2, 3);<br> ?column? | ?column? | ?column? <br>----------+----------+----------<br> 1 | 2 | 3<br>(1 row)<br><br>EXECUTE foo(1, 2);<br>ERROR: wrong number of parameters for prepared statement "foo"<br>DETAIL: Expected 3 parameters but got 2.</div><div>------------------------------------------------------------------------------------------</div><div><br></div><div>MySQL<br></div><div>------------------------------------------------------------------------------------------</div>PREPARE foo FROM 'SELECT ?, ?, ?'; <br>SET @a = 1; <br>SET @b = 2; <br>SET @c = 3; <br>EXECUTE foo USING @a, @b, @c;<br>+------+------+------+<br>| ? | ? | ? |<br>+------+------+------+<br>| 0x31 | 0x32 | 0x33 |<br>+------+------+------+</div><div class="gmail_quote"><br>EXECUTE foo USING @a, @b; <br>ERROR 1210 (HY000): Incorrect arguments to EXECUTE</div><div class="gmail_quote">------------------------------------------------------------------------------------------</div><br clear="all"><br>-- <br><div dir="ltr" class="gmail_signature">Thank you and best regards,<br>Eugene Leonovich</div></div>