Tested on MW 1.31.2 and Cargo 2.2. If a table contains a virtual field, the name of that field cannot be used inside strings of query parameters. For example, given the table
{{#cargo_declare:_table=Bug
|abc=String
|xyz=List (,) of Integer
}}the query
{{#cargo_query:tables=Bug|where=abc='xyz'}}fails with this message:
Error: operator for the virtual field 'Bug.xyz' must be 'HOLDS', 'HOLDS NOT', 'HOLDS LIKE' or 'HOLDS NOT LIKE'.
Similarly, in Lua the following query also results in the same error:
mw.ext.cargo.query('Bug', '_pageName', {where = "abc='xyz'"})This particular error can be avoided by using abc=CONCAT('x','yz') as the where-clause; since xyz does not appear literally in the clause, Cargo runs the query fine without errors. In general, however, the where-clause may be assembled from template or module parameters, in which case every query needs to be manually escaped in such a contrived manner. Live example.