This is an automated email from the ASF dual-hosted git repository.

diwu pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/master by this push:
     new ec4d0e81df4 [improve](job) Modify the prompt for job creation failure 
when there is no use db (#55422)
ec4d0e81df4 is described below

commit ec4d0e81df466e5a876cdc7d29f549303d734cd3
Author: wudi <[email protected]>
AuthorDate: Fri Sep 26 11:54:46 2025 +0800

    [improve](job) Modify the prompt for job creation failure when there is no 
use db (#55422)
    
    ### What problem does this PR solve?
    
    When there is no use db, creating a job will result in an error
    before:
    ```sql
    mysql> CREATE JOB my_job ON SCHEDULE EVERY 1 MINUTE DO INSERT INTO db1.tbl1 
SELECT * FROM db2.tbl2;
    ERROR 1105 (HY000): errCode = 2, detailMessage = Unknown database ''
    ```
    after:
    ```sql
    ERROR 1105 (HY000): errCode = 2, detailMessage = No database selected
    ```
---
 .../apache/doris/nereids/trees/plans/commands/info/CreateJobInfo.java  | 3 +++
 1 file changed, 3 insertions(+)

diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/info/CreateJobInfo.java
 
b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/info/CreateJobInfo.java
index fecac5e135c..9493cf5d6d7 100644
--- 
a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/info/CreateJobInfo.java
+++ 
b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/info/CreateJobInfo.java
@@ -118,6 +118,9 @@ public class CreateJobInfo {
         String jobName = labelNameOptional.get();
         checkJobName(jobName);
         String dbName = ctx.getDatabase();
+        if (Strings.isNullOrEmpty(dbName)) {
+            ErrorReport.reportAnalysisException(ErrorCode.ERR_NO_DB_ERROR);
+        }
 
         Env.getCurrentInternalCatalog().getDbOrAnalysisException(dbName);
         // check its insert stmt,currently only support insert stmt


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to