agentlang-ai / agentlang

Generative AI-powered Programming Language
Apache License 2.0
119 stars 4 forks source link

Postgres start up error on `0.6.0-alpha1` #1508

Closed muazzam0x48 closed 2 hours ago

muazzam0x48 commented 3 hours ago

Setting store as Postgres in config.edn:

:store {:type :postgres
         :host #$ POSTGRES_HOST
         :username #$ POSTGRES_USER
         :password #$ POSTGRES_PASSWORD
         :dbname #$ POSTGRES_DB}

Running agent run fails, displaying this error:

Exception in thread "main" org.postgresql.util.PSQLException: ERROR: relation "agentlang_kernel_rbac__instanceprivilegeassignment_0_6_0_alpha1" already exists
        at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2674)
        at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:2364)
        at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:354)
        at org.postgresql.jdbc.PgStatement.executeInternal(PgStatement.java:484)
        at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:404)
        at org.postgresql.jdbc.PgPreparedStatement.executeWithFlags(PgPreparedStatement.java:162)
        at org.postgresql.jdbc.PgPreparedStatement.execute(PgPreparedStatement.java:151)
        at com.mchange.v2.c3p0.impl.NewProxyPreparedStatement.execute(NewProxyPreparedStatement.java:989)
        at next.jdbc.result_set$stmt__GT_result_set.invokeStatic(result_set.clj:669)
        at next.jdbc.result_set$stmt__GT_result_set.invoke(result_set.clj:664)
        at next.jdbc.result_set$fn__16487.invokeStatic(result_set.clj:897)
        at next.jdbc.result_set$fn__16487.invoke(result_set.clj:857)
        at next.jdbc.protocols$fn__15720$G__15715__15729.invoke(protocols.clj:34)
        at next.jdbc$execute_BANG_.invokeStatic(jdbc.clj:251)
        at next.jdbc$execute_BANG_.invoke(jdbc.clj:238)
        at agentlang.store.jdbc_internal$execute_sql_BANG_.invokeStatic(jdbc_internal.clj:117)
        at agentlang.store.jdbc_internal$execute_sql_BANG_.invoke(jdbc_internal.clj:116)
        at agentlang.store.db_common$create_relational_table.invokeStatic(db_common.cljc:131)
        at agentlang.store.db_common$create_relational_table.invoke(db_common.cljc:124)
        at agentlang.store.db_common$create_schema$fn__18139.invoke(db_common.cljc:184)
        at agentlang.store.jdbc_internal$execute_fn_BANG_.invokeStatic(jdbc_internal.clj:114)
        at agentlang.store.jdbc_internal$execute_fn_BANG_.invoke(jdbc_internal.clj:110)
        at agentlang.store.db_common$create_schema.invokeStatic(db_common.cljc:174)
        at agentlang.store.db_common$create_schema.invoke(db_common.cljc:167)
        at agentlang.store.postgres$make$reify__18424.create_schema(postgres.clj:63)
        at agentlang.store.protocol$fn__14709$G__14662__14712.invoke(protocol.cljc:10)
        at agentlang.store.protocol$fn__14709$G__14661__14716.invoke(protocol.cljc:10)
        at agentlang.store$maybe_init_schema$fn__18593.invoke(store.cljc:201)
        at agentlang.store$maybe_init_schema.invokeStatic(store.cljc:196)
        at agentlang.store$maybe_init_schema.invoke(store.cljc:194)
        at agentlang.store$init_all_schema.invokeStatic(store.cljc:208)
        at agentlang.store$init_all_schema.invoke(store.cljc:205)
        at agentlang.util.runtime$init_runtime.invokeStatic(runtime.clj:179)
        at agentlang.util.runtime$init_runtime.invoke(runtime.clj:170)
        at agentlang.util.runtime$prepare_runtime.invokeStatic(runtime.clj:220)
        at agentlang.util.runtime$prepare_runtime.invoke(runtime.clj:208)
        at agentlang.core$run_service.invokeStatic(core.clj:46)
        at agentlang.core$run_service.invoke(core.clj:44)
        at agentlang.core$run_service.invokeStatic(core.clj:50)
        at agentlang.core$run_service.invoke(core.clj:44)
        at agentlang.core$_main$fn__42280$fn__42281.invoke(core.clj:277)
        at agentlang.util.runtime$call_after_load_model.invokeStatic(runtime.clj:303)
        at agentlang.util.runtime$call_after_load_model.invoke(runtime.clj:296)
        at agentlang.util.runtime$call_after_load_model.invokeStatic(runtime.clj:305)
        at agentlang.util.runtime$call_after_load_model.invoke(runtime.clj:296)
        at agentlang.core$_main$fn__42280.invoke(core.clj:276)
vijayfractl commented 2 hours ago

This is because of the internal postgres error:

identifier "agentlang_kernel_rbac__instanceprivilegeassignment_0_6_0_alpha1_pk" will be truncated to "agentlang_kernel_rbac__instanceprivilegeassignment_0_6_0_alpha1"

I think we need to create a truncated pk name on agentlang side.

vijayfractl commented 2 hours ago

fixed here: https://github.com/agentlang-ai/agentlang/pull/1510. Very long table names can still cause issues in some databases, model-developers should know the limits of the backend they are using and name components and entities accordingly.