[Bug][SQL] org.postgresql.util.PSQLException: ERROR: column "group_name" named in key does not exist
To Reproduce Steps to reproduce the behavior, for example:
- Run DolphinScheduler with PostgreSQL
- Click on the class 'CreateDolphinScheduler'
- See error
Expected behavior
Bug fixed
Screenshots
16:55:01.862 [main] INFO org.apache.dolphinscheduler.common.utils.ScriptRunner - sql: DROP FUNCTION IF EXISTS uc_dolphin_T_t_ds_alertgroup_A_create_user_id()
16:55:01.869 [main] INFO org.apache.dolphinscheduler.common.utils.ScriptRunner - -- uc_dolphin_T_t_ds_alertgroup_A_add_UN_groupName
16:55:01.869 [main] INFO org.apache.dolphinscheduler.common.utils.ScriptRunner - sql: CREATE OR REPLACE FUNCTION uc_dolphin_T_t_ds_alertgroup_A_add_UN_groupName() RETURNS void AS $$ BEGIN IF NOT EXISTS (SELECT 1 FROM pg_stat_all_indexes WHERE relname='t_ds_alertgroup' AND indexrelname ='t_ds_alertgroup_name_UN') THEN ALTER TABLE t_ds_process_definition ADD CONSTRAINT t_ds_alertgroup_name_UN UNIQUE (group_name); END IF; END; $$ LANGUAGE plpgsql;
16:55:01.882 [main] INFO org.apache.dolphinscheduler.common.utils.ScriptRunner - sql: SELECT uc_dolphin_T_t_ds_alertgroup_A_add_UN_groupName()
16:55:01.904 [main] ERROR org.apache.dolphinscheduler.common.utils.ScriptRunner - SQLException
org.postgresql.util.PSQLException: ERROR: column "group_name" named in key does not exist
在位置:SQL statement "ALTER TABLE t_ds_process_definition ADD CONSTRAINT t_ds_alertgroup_name_UN UNIQUE (group_name)"
PL/pgSQL function uc_dolphin_t_t_ds_alertgroup_a_add_un_groupname() line 1 at SQL statement
at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2440)
at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:2183)
at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:308)
at org.postgresql.jdbc.PgStatement.executeInternal(PgStatement.java:441)
at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:365)
at org.postgresql.jdbc.PgStatement.executeWithFlags(PgStatement.java:307)
at org.postgresql.jdbc.PgStatement.executeCachedSql(PgStatement.java:293)
at org.postgresql.jdbc.PgStatement.executeWithFlags(PgStatement.java:270)
at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:266)
at com.alibaba.druid.pool.DruidPooledStatement.execute(DruidPooledStatement.java:633)
at org.apache.dolphinscheduler.common.utils.ScriptRunner.runScript(ScriptRunner.java:145)
at org.apache.dolphinscheduler.common.utils.ScriptRunner.runScript(ScriptRunner.java:75)
at org.apache.dolphinscheduler.dao.upgrade.UpgradeDao.upgradeDolphinSchedulerDDL(UpgradeDao.java:489)
at org.apache.dolphinscheduler.dao.upgrade.UpgradeDao.upgradeDolphinScheduler(UpgradeDao.java:267)
at org.apache.dolphinscheduler.dao.upgrade.DolphinSchedulerManager.upgradeDolphinScheduler(DolphinSchedulerManager.java:117)
at org.apache.dolphinscheduler.dao.upgrade.shell.CreateDolphinScheduler.main(CreateDolphinScheduler.java:40)
16:55:01.904 [main] ERROR org.apache.dolphinscheduler.common.utils.ScriptRunner - Error executing: SELECT uc_dolphin_T_t_ds_alertgroup_A_add_UN_groupName()
16:55:01.904 [main] ERROR org.apache.dolphinscheduler.dao.upgrade.UpgradeDao - ERROR: column "group_name" named in key does not exist
在位置:SQL statement "ALTER TABLE t_ds_process_definition ADD CONSTRAINT t_ds_alertgroup_name_UN UNIQUE (group_name)"
PL/pgSQL function uc_dolphin_t_t_ds_alertgroup_a_add_un_groupname() line 1 at SQL statement
org.postgresql.util.PSQLException: ERROR: column "group_name" named in key does not exist
在位置:SQL statement "ALTER TABLE t_ds_process_definition ADD CONSTRAINT t_ds_alertgroup_name_UN UNIQUE (group_name)"
PL/pgSQL function uc_dolphin_t_t_ds_alertgroup_a_add_un_groupname() line 1 at SQL statement
at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2440)
at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:2183)
at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:308)
at org.postgresql.jdbc.PgStatement.executeInternal(PgStatement.java:441)
at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:365)
at org.postgresql.jdbc.PgStatement.executeWithFlags(PgStatement.java:307)
at org.postgresql.jdbc.PgStatement.executeCachedSql(PgStatement.java:293)
at org.postgresql.jdbc.PgStatement.executeWithFlags(PgStatement.java:270)
at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:266)
at com.alibaba.druid.pool.DruidPooledStatement.execute(DruidPooledStatement.java:633)
at org.apache.dolphinscheduler.common.utils.ScriptRunner.runScript(ScriptRunner.java:145)
at org.apache.dolphinscheduler.common.utils.ScriptRunner.runScript(ScriptRunner.java:75)
at org.apache.dolphinscheduler.dao.upgrade.UpgradeDao.upgradeDolphinSchedulerDDL(UpgradeDao.java:489)
at org.apache.dolphinscheduler.dao.upgrade.UpgradeDao.upgradeDolphinScheduler(UpgradeDao.java:267)
at org.apache.dolphinscheduler.dao.upgrade.DolphinSchedulerManager.upgradeDolphinScheduler(DolphinSchedulerManager.java:117)
at org.apache.dolphinscheduler.dao.upgrade.shell.CreateDolphinScheduler.main(CreateDolphinScheduler.java:40)
16:55:01.909 [main] ERROR org.apache.dolphinscheduler.dao.upgrade.shell.CreateDolphinScheduler - create DolphinScheduler failed
java.lang.RuntimeException: ERROR: column "group_name" named in key does not exist
在位置:SQL statement "ALTER TABLE t_ds_process_definition ADD CONSTRAINT t_ds_alertgroup_name_UN UNIQUE (group_name)"
PL/pgSQL function uc_dolphin_t_t_ds_alertgroup_a_add_un_groupname() line 1 at SQL statement
at org.apache.dolphinscheduler.dao.upgrade.UpgradeDao.upgradeDolphinSchedulerDDL(UpgradeDao.java:502)
at org.apache.dolphinscheduler.dao.upgrade.UpgradeDao.upgradeDolphinScheduler(UpgradeDao.java:267)
at org.apache.dolphinscheduler.dao.upgrade.DolphinSchedulerManager.upgradeDolphinScheduler(DolphinSchedulerManager.java:117)
at org.apache.dolphinscheduler.dao.upgrade.shell.CreateDolphinScheduler.main(CreateDolphinScheduler.java:40)
Caused by: org.postgresql.util.PSQLException: ERROR: column "group_name" named in key does not exist
在位置:SQL statement "ALTER TABLE t_ds_process_definition ADD CONSTRAINT t_ds_alertgroup_name_UN UNIQUE (group_name)"
PL/pgSQL function uc_dolphin_t_t_ds_alertgroup_a_add_un_groupname() line 1 at SQL statement
at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2440)
at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:2183)
at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:308)
at org.postgresql.jdbc.PgStatement.executeInternal(PgStatement.java:441)
at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:365)
at org.postgresql.jdbc.PgStatement.executeWithFlags(PgStatement.java:307)
at org.postgresql.jdbc.PgStatement.executeCachedSql(PgStatement.java:293)
at org.postgresql.jdbc.PgStatement.executeWithFlags(PgStatement.java:270)
at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:266)
at com.alibaba.druid.pool.DruidPooledStatement.execute(DruidPooledStatement.java:633)
at org.apache.dolphinscheduler.common.utils.ScriptRunner.runScript(ScriptRunner.java:145)
at org.apache.dolphinscheduler.common.utils.ScriptRunner.runScript(ScriptRunner.java:75)
at org.apache.dolphinscheduler.dao.upgrade.UpgradeDao.upgradeDolphinSchedulerDDL(UpgradeDao.java:489)
... 3 common frames omitted
Which version of Dolphin Scheduler: -[dev]
@ruanwenjun
Hi:
- Thank you for your feedback, we have received your issue, Please wait patiently for a reply.
- In order for us to understand your request as soon as possible, please provide detailed information、version or pictures.
- If you haven't received a reply for a long time, you can subscribe to the developer's email,Mail subscription steps reference https://dolphinscheduler.apache.org/zh-cn/community/development/subscribe.html ,Then write the issue URL in the email content and send question to [email protected].
Sorry, this is my problem, the table name is wrong. https://github.com/apache/dolphinscheduler/blob/cc9e5d5d34fcf2279b267cca7df37a9e80eeba07/sql/upgrade/1.4.0_schema/postgresql/dolphinscheduler_ddl.sql#L279 t_ds_process_definition should changed to t_ds_alertgroup
https://github.com/apache/dolphinscheduler/blob/cc9e5d5d34fcf2279b267cca7df37a9e80eeba07/sql/upgrade/1.4.0_schema/postgresql/dolphinscheduler_ddl.sql#L297
t_ds_process_definition should changed to t_ds_datasource
I submitted pr, I don’t know if the steps are right or not, what needs to be done, the first time I submit
@chengshiwen