!SQLException:sql.bind:42000!Column type mismatch
Hi, I'm doing some tests about bind operation with v11.33.11 (Apr2019-SP1) and here's how to reproduce: ``` mclient -d test sql>create table unary(a int); sql>insert into unary(a) select value from generate_series(1, 101, 1); mclient -d test -l mal mal>sql.init(); mal>s := sql.mvc(); mal>a := sql.bind(s, "sys", "unary", "a", 0); ``` Then I got `!SQLException:sql.bind:42000!Column type mismatch`. I traced it down to `sql/backends/monet5/sql.c:mvc_bind_wrap`, `int coltype = getBatType(getArgType(mb, pci, 0));` coltype is set to 255 here, which confused me about what this coltype is used for. Also in `sql/backends/monet5/sql.mal`, the comment says the access kind (last argument) is divided into `0, base table`, `1, inserts` and `2, updates`. In what scenarios are these values used? Is `0` for read only operations? What about delete operations? Thanks for your help. Best regards, Jiading Guo
On 09/09/2019 05:05, Jiading Guo wrote:
Hi,
Hi What is the goal of these tests?
I'm doing some tests about bind operation with v11.33.11 (Apr2019-SP1) and here's how to reproduce:
``` mclient -d test sql>create table unary(a int); sql>insert into unary(a) select value from generate_series(1, 101, 1);
mclient -d test -l mal mal>sql.init(); mal>s := sql.mvc(); mal>a := sql.bind(s, "sys", "unary", "a", 0); The type of a can not be determined statically from the sql.bind() operation. You should use something like:
a[:int] := sql.bind(s, "sys", "unary", "a", 0);
``` Then I got `!SQLException:sql.bind:42000!Column type mismatch`.
I traced it down to `sql/backends/monet5/sql.c:mvc_bind_wrap`, `int coltype = getBatType(getArgType(mb, pci, 0));` coltype is set to 255 here, which confused me about what this coltype is used for.
Also in `sql/backends/monet5/sql.mal`, the comment says the access kind (last argument) is divided into `0, base table`, `1, inserts` and `2, updates`. In what scenarios are these values used? Is `0` for read only operations? What about delete operations?
MonetDB uses a delta-based scheme to record planned updates. regards, Martin
Thanks for your help.
Best regards, Jiading Guo _______________________________________________ users-list mailing list users-list@monetdb.org https://www.monetdb.org/mailman/listinfo/users-list
Thanks Martin. I'm just wrapping my head around BAT, nothing special here.
For those who tried but failed, try `a:bat[:int] := sql.bind(s, "sys",
"unary", "a", 0);` again.
BTW how can I inspect the type of a variable?
Many thanks,
Jiading Guo
On Mon, Sep 9, 2019 at 2:01 PM Martin Kersten
On 09/09/2019 05:05, Jiading Guo wrote:
Hi,
Hi
What is the goal of these tests?
I'm doing some tests about bind operation with v11.33.11 (Apr2019-SP1) and here's how to reproduce:
``` mclient -d test sql>create table unary(a int); sql>insert into unary(a) select value from generate_series(1, 101, 1);
mclient -d test -l mal mal>sql.init(); mal>s := sql.mvc(); mal>a := sql.bind(s, "sys", "unary", "a", 0); The type of a can not be determined statically from the sql.bind() operation. You should use something like:
a[:int] := sql.bind(s, "sys", "unary", "a", 0);
``` Then I got `!SQLException:sql.bind:42000!Column type mismatch`.
I traced it down to `sql/backends/monet5/sql.c:mvc_bind_wrap`, `int coltype = getBatType(getArgType(mb, pci, 0));` coltype is set to 255 here, which confused me about what this coltype is used for.
Also in `sql/backends/monet5/sql.mal`, the comment says the access kind (last argument) is divided into `0, base table`, `1, inserts` and `2, updates`. In what scenarios are these values used? Is `0` for read only operations? What about delete operations?
MonetDB uses a delta-based scheme to record planned updates.
regards, Martin
Thanks for your help.
Best regards, Jiading Guo _______________________________________________ users-list mailing list users-list@monetdb.org https://www.monetdb.org/mailman/listinfo/users-list
_______________________________________________ users-list mailing list users-list@monetdb.org https://www.monetdb.org/mailman/listinfo/users-list
participants (2)
-
Jiading Guo
-
Martin Kersten