You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Spring AI默认PgVector Store表无法通过psql CLI查看的原因咨询

问题描述

基于Spring Boot + Postgres的RAG实验中,使用Spring AI的PgVectorStore默认配置存储向量数据,Spring Boot应用可正常从向量库检索数据,且能看到vector函数,但通过psql CLI执行\dt vector_store时提示找不到该表:

smarthire=# \df vector
                          List of functions
 Schema |  Name  | Result data type |   Argument data types    | Type 
--------+--------+------------------+--------------------------+------
 public | vector | vector           | vector, integer, boolean | func
(1 row)

smarthire=# \dt vector_store
Did not find any relation named "vector_store".

未修改过默认表名,询问找不到表的原因及解决办法。

可能的原因及解决办法
  • 表不在当前搜索的schema下
    执行\dn查看所有schema,再用\dt *.vector_store搜索所有schema下的该表。如果找到表在其他schema(比如ai),可以切换schema:SET search_path TO ai, public;,之后再用\dt vector_store就能看到。
  • 表名存在大小写敏感问题
    如果创建表时用了带引号的标识符(比如"Vector_Store"),psql需要匹配大小写才能查到。执行\dt "vector_store"试试,或者用\dt *列出所有表,手动查找向量表。
  • 当前psql用户无表的查看权限
    若表是其他数据库用户创建的,当前用户可能没有该表的USAGE或SELECT权限。可以切换到超级用户(比如postgres)执行\dt vector_store,或者给当前用户授权:GRANT SELECT ON vector_store TO 你的用户名;。
  • 连接的数据库与应用不一致
    确认psql连接的数据库和Spring Boot应用配置的数据库是同一个。执行SELECT current_database();查看当前数据库,对比应用配置文件中的spring.datasource.url里的数据库名。

内容的提问来源于stack exchange,提问作者nantitv

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.12 21:22:37