proto.io 0.0.169 → 0.0.170

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2270,8 +2270,12 @@ const encodeFieldExpression = (compiler, parent, field, expr) => {
2270
2270
  if (relation && parent.className) {
2271
2271
  if (!_.every(expr.value, x => x instanceof TObject && x.objectId))
2272
2272
  break;
2273
+ const tempName = `_populate_expr_$${compiler.nextIdx()}`;
2273
2274
  const populate = _selectRelationPopulate(compiler, { className: parent.className, name: parent.name }, relation.populate, `$${field}`, false);
2274
- return sql `ARRAY(SELECT ${{ identifier: '_id' }} FROM (${populate})) ${{ literal: op }} ARRAY[${_.map(expr.value, (x) => sql `${{ value: x.objectId }}`)}]`;
2275
+ return sql `ARRAY(
2276
+ SELECT ${{ identifier: '_id' }}
2277
+ FROM (${populate}) AS ${{ identifier: tempName }}
2278
+ ) ${{ literal: op }} ARRAY[${_.map(expr.value, (x) => sql `${{ value: x.objectId }}`)}]`;
2275
2279
  }
2276
2280
  if (!dataType) {
2277
2281
  return sql `jsonb_typeof(${element}) ${nullSafeEqual()} 'array' AND ${element} ${{ literal: op }} ${_encodeJsonValue(_encodeValue(expr.value))}`;