mirror of
https://github.com/scylladb/scylladb.git
synced 2026-05-12 19:02:12 +00:00
cql3: fix INSERT JSON grammar
Previously CQL grammar wrongfully required INSERT JSON queries to provide a list of columns, even though they are already present in JSON itself. Unfortunately, tests were written with this false assumption as well, so they're are updated. Message-Id: <33b496cba523f0f27b6cbf5539a90b6feb20269e.1532514111.git.sarna@scylladb.com>
This commit is contained in:
committed by
Paweł Dziepak
parent
b443a9b930
commit
f66aace685
@@ -473,9 +473,9 @@ insertStatement returns [::shared_ptr<raw::modification_statement> expr]
|
||||
::shared_ptr<cql3::term::raw> json_value;
|
||||
}
|
||||
: K_INSERT K_INTO cf=columnFamilyName
|
||||
'(' c1=cident { column_names.push_back(c1); } ( ',' cn=cident { column_names.push_back(cn); } )* ')'
|
||||
( K_VALUES
|
||||
'(' v1=term { values.push_back(v1); } ( ',' vn=term { values.push_back(vn); } )* ')'
|
||||
('(' c1=cident { column_names.push_back(c1); } ( ',' cn=cident { column_names.push_back(cn); } )* ')'
|
||||
K_VALUES
|
||||
'(' v1=term { values.push_back(v1); } ( ',' vn=term { values.push_back(vn); } )* ')'
|
||||
( K_IF K_NOT K_EXISTS { if_not_exists = true; } )?
|
||||
( usingClause[attrs] )?
|
||||
{
|
||||
|
||||
@@ -2783,7 +2783,7 @@ SEASTAR_TEST_CASE(test_insert_json_types) {
|
||||
|
||||
e.require_table_exists("ks", "all_types").get();
|
||||
e.execute_cql(
|
||||
"INSERT INTO all_types (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, u) JSON '"
|
||||
"INSERT INTO all_types JSON '"
|
||||
"{\"a\": \"ascii\", "
|
||||
"\"b\": 123456789, "
|
||||
"\"c\": \"0xdeadbeef\", "
|
||||
@@ -2863,7 +2863,7 @@ SEASTAR_TEST_CASE(test_insert_json_collections) {
|
||||
e.require_table_exists("ks", "collections").get();
|
||||
|
||||
e.execute_cql(
|
||||
"INSERT INTO collections (a, b, c, d) JSON '"
|
||||
"INSERT INTO collections JSON '"
|
||||
"{\"a\": \"key\", "
|
||||
"\"b\": {\"1\": \"abc\", \"2\": \"!\", \"3\": \"de\"}, "
|
||||
"\"c\": [0, 1.125, 2.25, 4.5], "
|
||||
@@ -2898,10 +2898,10 @@ SEASTAR_TEST_CASE(test_prepared_json) {
|
||||
|
||||
cql3::prepared_cache_key_type prepared_id = e.prepare(
|
||||
"begin batch \n"
|
||||
" insert into json_data (k, v) json :named_bound0; \n"
|
||||
" insert into json_data (k, v) json ?; \n"
|
||||
" insert into json_data (k, v) json :named_bound1; \n"
|
||||
" insert into json_data (k, v) json ?; \n"
|
||||
" insert into json_data json :named_bound0; \n"
|
||||
" insert into json_data json ?; \n"
|
||||
" insert into json_data json :named_bound1; \n"
|
||||
" insert into json_data json ?; \n"
|
||||
"apply batch;").get0();
|
||||
|
||||
std::vector<cql3::raw_value> raw_values;
|
||||
|
||||
Reference in New Issue
Block a user