@rex0220/kintone-sql-tools 3.33.0 → 3.34.1

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.
package/dist-cli/ksql.js CHANGED
@@ -10695,6 +10695,19 @@ function statementContainsOuterJoin(statement) {
10695
10695
  };
10696
10696
  return visit(statement);
10697
10697
  }
10698
+ function isOuterJoinNonPreservedTable(statement, table, isMainTable) {
10699
+ if (isMainTable) {
10700
+ return table === statement.from && statement.joins.some((join2) => join2.type === "RIGHT");
10701
+ }
10702
+ for (let index = 0; index < statement.joins.length; index += 1) {
10703
+ const join2 = statement.joins[index];
10704
+ if (join2.type === "LEFT" && table === join2.table) return true;
10705
+ if (join2.type === "RIGHT" && statement.joins.slice(0, index).some((previousJoin) => table === previousJoin.table)) {
10706
+ return true;
10707
+ }
10708
+ }
10709
+ return false;
10710
+ }
10698
10711
 
10699
10712
  // src/core/explainMetadata.ts
10700
10713
  function buildGroupingExplainMetadata(statement, canonicalItemCount) {
@@ -18654,6 +18667,12 @@ async function fetchTableRecordsForFullScan(stmt, table, client, maxRecords, par
18654
18667
  const onTruncate = (max) => {
18655
18668
  warnings.add(`\u53D6\u5F97\u4E0A\u9650\uFF08${max} \u4EF6\uFF09\u306B\u9054\u3057\u305F\u305F\u3081\u3001${max} \u4EF6\u3067\u6253\u3061\u5207\u3063\u3066\u8868\u793A\u3057\u3066\u3044\u307E\u3059\u3002`);
18656
18669
  markLimitReached(client, table.appId);
18670
+ if (isOuterJoinNonPreservedTable(stmt, table, isMainTable)) {
18671
+ throw new FetchAllLimitError(
18672
+ `\u5916\u90E8\u7D50\u5408\u306E\u6B63\u3057\u3044\u7D50\u679C\u306B\u306F\u5B8C\u5168\u306A\u5019\u88DC\u96C6\u5408\u304C\u5FC5\u8981\u3067\u3059\u3002complete input reason: OUTER_JOIN_NON_PRESERVED\uFF08APP${table.appId}\uFF09\u3002onLimit=truncate\u306F\u4F7F\u7528\u3067\u304D\u307E\u305B\u3093\u3002\u53D6\u5F97\u4EF6\u6570\u304C\u4E0A\u9650\uFF08${max} \u4EF6\uFF09\u3092\u8D85\u3048\u307E\u3057\u305F\u3002WHERE \u53E5\u3067\u7D5E\u308A\u8FBC\u3080\u304B\u3001maxRecords \u3092\u5F15\u304D\u4E0A\u3052\u3066\u304F\u3060\u3055\u3044\u3002`,
18673
+ true
18674
+ );
18675
+ }
18657
18676
  };
18658
18677
  if (!table.subtableCode) {
18659
18678
  const baseQuery = isMainTable && allowOriginalWherePushdown ? selectToFetchAllParams(stmt, table.appId).query : "";