[Question posted by a user on YugabyteDB Community Slack ]
I am trying to perform Light weight transaction using update
statement. Is there any guarantee on the order of columns returned if the IF expression
is failed. Below is my table model & the query I’m trying to attempt:
$ create table test.sample (ip inet, hr int, source text, source_id text, g map<int, int>, b map<int, int>, r map<int, int>, c map<int, blob>, primary key(ip, hr, source, source_id));
$ insert into sample(ip, hr, source, source_id, g, b, r, c) values('1.2.3.4',456, 'alpha', 'a',{0:1},{1:2},{2:1},{0:0x12});
$ update sample set g[1]=10 where ip='1.2.3.4' and hr=456 and source='alpha' and source_id='a' if g[0]=1 and b[1]=3;
[applied] | ip | hr | source | source_id | b | g
-----------+---------+-----+--------+-----------+--------+--------
False | 1.2.3.4 | 456 | alpha | a | {1: 2} | {0: 1}
$ update sample set g[1]=10 where ip='1.2.3.4' and hr=456 and source='alpha' and source_id='a' if g[0]=1 and b[1]=3 and r[0]=2 and c[0]=0xaf;;
[applied] | ip | hr | source | source_id | c | r | b | g
-----------+---------+-----+--------+-----------+-----------+--------+--------+--------
False | 1.2.3.4 | 456 | alpha | a | {0: 0x12} | {2: 1} | {1: 2} | {0: 1}
- how to determine the order of columns returned, such that I can utilize them for retry?
- what is the logic in deciding which columns should be returned for a
failed
LWT statement? Is it amalgamation of (where & IF expressions)