From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lj1-f193.google.com (mail-lj1-f193.google.com [209.85.208.193]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id 2D1904696C3 for ; Sat, 4 Apr 2020 00:23:37 +0300 (MSK) Received: by mail-lj1-f193.google.com with SMTP id p14so8424629lji.11 for ; Fri, 03 Apr 2020 14:23:37 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Eugene Leonovich Date: Fri, 3 Apr 2020 23:23:10 +0200 Message-ID: Content-Type: multipart/alternative; boundary="000000000000c5ab2505a2698760" Subject: Re: [Tarantool-patches] [PATCH] sql: reset values to be bound after execution List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Nikita Pettik Cc: tarantool-patches@dev.tarantool.org, v.shpilevoy@tarantool.org --000000000000c5ab2505a2698760 Content-Type: text/plain; charset="UTF-8" On Fri, Apr 3, 2020 at 8:22 PM Nikita Pettik wrote: > +execute(s.stmt_id, {{[':a'] = 1}, {[':b'] = 2}}); > + | --- > + | - metadata: > + | - name: :a > + | type: integer > + | - name: :b > + | type: integer > + | - name: :c > + | type: boolean > + | rows: > + | - [1, 2, null] > I wonder, shouldn't an error be thrown if there are not enough parameters passed? I just checked Postgres and MySQL, optional parameters are forbidden on both systems: Postgres ------------------------------------------------------------------------------------------ PREPARE foo (int, int, int) AS SELECT $1, $2, $3; EXECUTE foo(1, 2, 3); ?column? | ?column? | ?column? ----------+----------+---------- 1 | 2 | 3 (1 row) EXECUTE foo(1, 2); ERROR: wrong number of parameters for prepared statement "foo" DETAIL: Expected 3 parameters but got 2. ------------------------------------------------------------------------------------------ MySQL ------------------------------------------------------------------------------------------ PREPARE foo FROM 'SELECT ?, ?, ?'; SET @a = 1; SET @b = 2; SET @c = 3; EXECUTE foo USING @a, @b, @c; +------+------+------+ | ? | ? | ? | +------+------+------+ | 0x31 | 0x32 | 0x33 | +------+------+------+ EXECUTE foo USING @a, @b; ERROR 1210 (HY000): Incorrect arguments to EXECUTE ------------------------------------------------------------------------------------------ -- Thank you and best regards, Eugene Leonovich --000000000000c5ab2505a2698760 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: base64 PGRpdiBkaXI9Imx0ciI+PGRpdiBkaXI9Imx0ciI+PGJyPjwvZGl2Pjxicj48ZGl2IGNsYXNzPSJn bWFpbF9xdW90ZSI+PGRpdiBkaXI9Imx0ciIgY2xhc3M9ImdtYWlsX2F0dHIiPk9uIEZyaSwgQXBy IDMsIDIwMjAgYXQgODoyMiBQTSBOaWtpdGEgUGV0dGlrICZsdDs8YSBocmVmPSJtYWlsdG86a29y YWJsZXZAdGFyYW50b29sLm9yZyI+a29yYWJsZXZAdGFyYW50b29sLm9yZzwvYT4mZ3Q7IHdyb3Rl Ojxicj48L2Rpdj48YmxvY2txdW90ZSBjbGFzcz0iZ21haWxfcXVvdGUiIHN0eWxlPSJtYXJnaW46 MHB4IDBweCAwcHggMC44ZXg7Ym9yZGVyLWxlZnQ6MXB4IHNvbGlkIHJnYigyMDQsMjA0LDIwNCk7 cGFkZGluZy1sZWZ0OjFleCI+DQorZXhlY3V0ZShzLnN0bXRfaWQsIHt7WyYjMzk7OmEmIzM5O10g PSAxfSwge1smIzM5OzpiJiMzOTtdID0gMn19KTs8YnI+DQorIHwgLS0tPGJyPg0KKyB8IC0gbWV0 YWRhdGE6PGJyPg0KKyB8wqAgwqAtIG5hbWU6IDphPGJyPg0KKyB8wqAgwqAgwqB0eXBlOiBpbnRl Z2VyPGJyPg0KKyB8wqAgwqAtIG5hbWU6IDpiPGJyPg0KKyB8wqAgwqAgwqB0eXBlOiBpbnRlZ2Vy PGJyPg0KKyB8wqAgwqAtIG5hbWU6IDpjPGJyPg0KKyB8wqAgwqAgwqB0eXBlOiBib29sZWFuPGJy Pg0KKyB8wqAgwqByb3dzOjxicj4NCisgfMKgIMKgLS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