Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Fix bulk query regex issue with parentheses in SELECT and WHERE clauses#1735

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Draft
Copilot wants to merge3 commits intomain
base:main
Choose a base branch
Loading
fromcopilot/fix-671

Conversation

Copy link

CopilotAI commentedJul 25, 2025
edited
Loading

Theconn.bulk.query() method was failing with error "No sobject type found in query" when queries contained parentheses in both SELECT and WHERE clauses. This was caused by a greedy regex that removed too much content from the query string.

Problem

The original regex/\([\s\S]+\)/g was designed to remove parenthesized content (like subqueries) to extract the main sobject type from the FROM clause. However, it used a greedy quantifier that matched from thefirst opening parenthesis to thelast closing parenthesis, which could remove the entire FROM clause in queries like:

SELECT x, y, (SELECT IdFROM SubObject1), (SELECT IdFROM SubObject2)FROM MyObject__cWHERE ((a=1AND b=2)OR c=3)

The regex would remove everything from(SELECT Id FROM SubObject1) throughOR c = 3), leaving onlySELECT x, y, and causing the FROM clause extraction to fail.

Solution

Replaced the single greedy regex with an iterative approach that removes parenthesized content level by level:

// Before (problematic)constm=soql.replace(/\([\s\S]+\)/g,'').match(/FROM\s+(\w+)/i);// After (fixed)letcleanedSoql=soql;while(/\([^()]*\)/.test(cleanedSoql)){cleanedSoql=cleanedSoql.replace(/\([^()]*\)/g,'');}constm=cleanedSoql.match(/FROM\s+(\w+)/i);

This approach correctly handles:

  • Multiple subqueries in SELECT clause
  • Nested parentheses in WHERE conditions
  • Complex nested subqueries
  • All existing simple cases

Testing

Added comprehensive test cases covering:

  • The original problematic query from the issue
  • Nested parentheses scenarios
  • Simple queries (regression testing)
  • Single subquery cases

All existing functionality remains unchanged, and the fix is minimal with only 8 lines of code modified.

Fixes#671.

Warning

Firewall rules blocked me from connecting to one or more addresses

I tried to connect to the following addresses, but was blocked by firewall rules:

  • googlechromelabs.github.io
  • https://storage.googleapis.com/chrome-for-testing-public/127.0.6533.72/linux64/chrome-headless-shell-linux64.zip
    • Triggering command:node install.mjs (http block)

If you need me to access, download, or install something from one of these locations, you can either:


💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Clickhere to start the survey.

CopilotAIand others added2 commitsJuly 25, 2025 02:07
Co-authored-by: cristiand391 <6853656+cristiand391@users.noreply.github.com>
Co-authored-by: cristiand391 <6853656+cristiand391@users.noreply.github.com>
CopilotAI changed the title[WIP] conn.bulk.query- "No sobject type found in query" when parentheses are used in both SELECT and WHERE clausesFix bulk query regex issue with parentheses in SELECT and WHERE clausesJul 25, 2025
CopilotAI requested a review fromcristiand391July 25, 2025 02:14
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@cristiand391cristiand391Awaiting requested review from cristiand391

At least 1 approving review is required to merge this pull request.

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

conn.bulk.query- "No sobject type found in query" when parentheses are used in both SELECT and WHERE clauses

2 participants

@cristiand391

[8]ページ先頭

©2009-2025 Movatter.jp