Skip to content

feat(cli): add sql_delimiter set #649

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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jul 21, 2025
Merged

feat(cli): add sql_delimiter set #649

merged 4 commits into from
Jul 21, 2025

Conversation

sundy-li
Copy link
Member

@sundy-li sundy-li commented Jul 20, 2025

changes:

  1. support setting sql_delimiter in cli which fixes bug: bendsql parse task with begin end will return err #648

example:

🐳 root@default:) !set sql_delimiter %
🐳 root@default:) explain ast CREATE TASK IF NOT EXISTS MyTask1 SCHEDULE = 1 SECOND as
begin
    begin;
    insert into t values('1');
    delete from t ;
    vacuum table t;
    SELECT
          {

              'avg_ads_rev': case when number=0 then 0
                                  when number=0 then 0.083903
                                  else (1/number)::DECIMAL(14,6) end
          }  AS features
    FROM t
    commit;
end%
-[ EXPLAIN ]-----------------------------------
CREATE TASK IF NOT EXISTS MyTask1 SCHEDULE = 1 SECOND AS BEGIN
BEGIN;
INSERT INTO t VALUES ('1');
DELETE FROM t;
VACUUM TABLE t ;
SELECT {'avg_ads_rev':CASE WHEN number = 0 THEN 0 WHEN number = 0 THEN 0.083903 ELSE (1 / number)::Decimal(14, 6) END} AS features FROM t AS commit;
END;

7 rows explain in 0.002 sec. Processed 0 rows, 0 B (0 row/s, 0 B/s)
  1. quote_string is set to false by default

@sundy-li sundy-li requested review from everpcpc and TCeason July 20, 2025 02:47
@sundy-li sundy-li merged commit 7d5cc04 into main Jul 21, 2025
6 checks passed
@sundy-li sundy-li deleted the sql_delimiter branch July 21, 2025 01:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

bug: bendsql parse task with begin end will return err
2 participants