You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ignite.apache.org by ashishb888 <as...@gmail.com> on 2019/04/02 07:32:59 UTC

SQLLine: Insert into for complex object not working

I have a cache, with complex key (3 fields). I am able get/put from/to the
cache.
But when I insert records from SQLLine, the first record goes to the cache,
but any subsequent insert fails
by giving "Error: Duplicate key during INSERT ....(state=23000,code=0)".

I created cache by CacheConfiguration.




--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/

Re: SQLLine: Insert into for complex object not working

Posted by Ilya Kasnacheev <il...@gmail.com>.
Hello!

Can you show your table config, SELECT *?

Regards,
-- 
Ilya Kasnacheev


вт, 2 апр. 2019 г. в 12:46, ashishb888 <as...@gmail.com>:

> INSERT INTO "SCHEMA".CACHE VALUES (101,31,11,null,'B','B','C','D'); //
> Inserted
> INSERT INTO "SCHEMA".CACHE VALUES (101,3,1,null,'B','B','C','D'); // Gave
> error
>
> First 3 fields are part of the key.
>
> Thanks
>
>
>
> --
> Sent from: http://apache-ignite-users.70518.x6.nabble.com/
>

Re: SQLLine: Insert into for complex object not working

Posted by ashishb888 <as...@gmail.com>.
INSERT INTO "SCHEMA".CACHE VALUES (101,31,11,null,'B','B','C','D'); //
Inserted
INSERT INTO "SCHEMA".CACHE VALUES (101,3,1,null,'B','B','C','D'); // Gave
error

First 3 fields are part of the key.

Thanks



--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/

Re: SQLLine: Insert into for complex object not working

Posted by Ilya Kasnacheev <il...@gmail.com>.
Hello!

It is also possible that something goes wrong with your column-field
mapping, so first entry is added with (null, null, null), and the second
one fails at adding the same.

Can you show your sqlline output when doing so?

Regards,
-- 
Ilya Kasnacheev


вт, 2 апр. 2019 г. в 10:43, ashishb888 <as...@gmail.com>:

> I have a cache, with complex key (3 fields). I am able get/put from/to the
> cache.
> But when I insert records from SQLLine, the first record goes to the cache,
> but any subsequent insert fails
> by giving "Error: Duplicate key during INSERT ....(state=23000,code=0)".
>
> I created cache by CacheConfiguration.
>
>
>
>
> --
> Sent from: http://apache-ignite-users.70518.x6.nabble.com/
>

Re: SQLLine: Insert into for complex object not working

Posted by Evgenii Zhuravlev <e....@gmail.com>.
Hi,

Looks like you're trying to insert the entry with the same key as before.
SQL INSERT command doesn't allow to do that(in all DBs). Looks like you
need to use UPDATE or UPSERT commands

Evgenii

вт, 2 апр. 2019 г. в 10:43, ashishb888 <as...@gmail.com>:

> I have a cache, with complex key (3 fields). I am able get/put from/to the
> cache.
> But when I insert records from SQLLine, the first record goes to the cache,
> but any subsequent insert fails
> by giving "Error: Duplicate key during INSERT ....(state=23000,code=0)".
>
> I created cache by CacheConfiguration.
>
>
>
>
> --
> Sent from: http://apache-ignite-users.70518.x6.nabble.com/
>