簡體   English   中英

嵌套異常是 org.postgresql.util.PSQLException:錯誤:關系“equ_config”不存在

[英]nested exception is org.postgresql.util.PSQLException: ERROR: relation "equ_config" does not exist

我正在用springboot + mybatis + Yugabyte開發一個后端程序。 它在開發環境中運行良好,但在在線環境中出現以下錯誤:

2021-04-14 13:52:15.123 [http-nio-8080-exec-8] DEBUG com.yoi.config.infrastructure.repository.mapper.ConfigMapper.liteConfigByType - ==>  Preparing: select * from "equ_config" where conf_type = ? and conf_df = true order by conf_order desc; 
2021-04-14 13:52:15.133 [http-nio-8080-exec-8] DEBUG com.yoi.config.infrastructure.repository.mapper.ConfigMapper.liteConfigByType - ==> Parameters: dept(String)
2021-04-14 13:52:15.459 [http-nio-8080-exec-8] ERROR org.apache.catalina.core.ContainerBase.[Tomcat].[localhost].[/].[dispatcherServlet] - Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is org.springframework.jdbc.BadSqlGrammarException: 
### Error querying database.  Cause: org.postgresql.util.PSQLException: ERROR: relation "equ_config" does not exist
  Position: 16
### The error may exist in URL [jar:file:/srvmgmt/java/target/equip-management-server.jar!/BOOT-INF/classes!/mapper/ConfigMapper.xml]
### The error may involve defaultParameterMap
### The error occurred while setting parameters
### SQL: select * from  "equ_config" where conf_type = ? and conf_df = true         order by conf_order desc;
### Cause: org.postgresql.util.PSQLException: ERROR: relation "equ_config" does not exist
  Position: 16
; bad SQL grammar []; nested exception is org.postgresql.util.PSQLException: ERROR: relation "equ_config" does not exist
  Position: 16] with root cause
org.postgresql.util.PSQLException: ERROR: relation "equ_config" does not exist
  Position: 16
    at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2532) ~[postgresql-42.2.14.jar!/:42.2.14]

映射器如下:

    <select id="liteConfigByType" resultType="com.yoi.config.infrastructure.repository.po.ConfigPO">
     select * from  equ_config where conf_type = #{type} and conf_df = true
        order by conf_order desc;
    </select>

查詢 sql select * from equ_config where conf_type = 'dept' and conf_df = true order by conf_order desc; 在 Navicat Gui 中運行良好,在線應用程序啟動良好。

我不知道出了什么問題。

對我來說,這看起來像是某個地方的配置問題。 沒有更多信息,很難找出問題的根本原因。 可能是這樣的:

  • 該表實際上並未創建。
  • 未正確設置贈款。
  • PROD 中的帳戶可能不同。
  • 表名、前綴或后綴中可能有不同的大小寫。
  • 你給它起名字...

可以幫助您診斷問題的技巧可以采取對information_schema進行查詢的形式,從應用程序本身運行,以找出應用程序正在查看的內容。 我的 MyBatis 映射器中有一些“額外”的查詢,如下所示:

<select id="searchTable" resultType="FoundTableVO">
  select table_schema, table_name
  from information_schema.tables
  where lower(table_name) like '%equ_config%'
</select>

上面的查詢將列出所有看起來像您的表的表,以及它們所在的架構。 像這樣的一些查詢將闡明這個問題。

確保表 equ_config 在公共模式中。 如果不是,請在表中使用 qweries 嘗試此語法:“schema_name.equ_config”

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM