Skip to content
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

Syntax error occured when using stored procedure in Vertica #23324

Open
ych-ot opened this issue Apr 5, 2024 · 4 comments · Fixed by #29995
Open

Syntax error occured when using stored procedure in Vertica #23324

ych-ot opened this issue Apr 5, 2024 · 4 comments · Fixed by #29995
Labels
AS blocked bug x:vertica xf:sql editor SQL Editor and Editor Services like autocompletion, highlighting, folding, formatting, etc.

Comments

@ych-ot
Copy link

ych-ot commented Apr 5, 2024

Description

It was OK in vsql or DbVisualizer but executed in DBeaver it failed with error messages "Missing a matching closing delimiter in statement " or "Syntax error at or near "n_Cnt" at character 7"

DBeaver Version

Community Edition 24.0.1.202403241413

Operating System

Windows 11

Database and driver

Database name: Vertica 23.4.0.7
Client: Vertica JDBC 23.4.0.7

Steps to reproduce

CREATE OR REPLACE PROCEDURE TEST1()
LANGUAGE PLvSQL AS 
$$
DECLARE
    i INT := 1;
BEGIN
    WHILE true LOOP
        IF i = 10 THEN
            EXIT;
        END IF;
    
        i := i + 1;
        
        RAISE NOTICE 'i [%]', i;
    END LOOP;
END;
$$;

--> Missing a matching closing delimiter in statement

CREATE OR REPLACE PROCEDURE TEST2()
LANGUAGE PLvSQL AS 
$$
DECLARE
        n_Cnt               INT;  
BEGIN 
        n_Cnt := 0;
        IF ( n_Cnt = 1 ) THEN
            RETURN  ;
        END IF;
END;
$$;

--> syntax error at or near "n_Cnt

Additional context

No response

@LonwoLonwo
Copy link
Member

Hello @ych-ot

Did you try to highlight the whole procedure creation query and then execute it?

@LonwoLonwo LonwoLonwo added xf:sql editor SQL Editor and Editor Services like autocompletion, highlighting, folding, formatting, etc. AS labels Apr 9, 2024
@LonwoLonwo
Copy link
Member

Ok, I see. Highlighting helps, but we need to parse this query more precisely.
Thanks for the bug report.

@arhayka arhayka added this to the 24.0.5 milestone Apr 10, 2024
@E1izabeth E1izabeth self-assigned this May 7, 2024
@E1izabeth E1izabeth added the sp:3 label May 7, 2024
@E1izabeth
Copy link
Member

As a workaround, you can set Show $$ quotes as setting to String literal in Connection Configuration
image

@E1izabeth
Copy link
Member

The issue can be solved only after #15542

@E1izabeth E1izabeth linked a pull request May 9, 2024 that will close this issue
@uslss uslss self-assigned this May 10, 2024
serge-rider pushed a commit that referenced this issue May 10, 2024
* #23324 Add loop as begin end block in Vertica

* #23324 Add declare keyword as block header
@E1izabeth E1izabeth reopened this May 17, 2024
@E1izabeth E1izabeth removed this from the 24.0.5 milestone May 17, 2024
@E1izabeth E1izabeth removed the sp:3 label May 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
AS blocked bug x:vertica xf:sql editor SQL Editor and Editor Services like autocompletion, highlighting, folding, formatting, etc.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants