Java 更新查询中的双引号

Java 更新查询中的双引号,java,postgresql,spring-boot,Java,Postgresql,Spring Boot,我在postgresql中有以下数据库 create table car_wash( id integer PK, images text[] ) 要将一些数据插入到使用spring boot的images数组中,这是我的存储库接口中的方法 @Modifying @Query(value = "update car_wash set images=array_append(images,'' || :item || '') where id =:id",nativeQuery

我在postgresql中有以下数据库

create table car_wash(
  id integer PK,
  images text[]
)
要将一些数据插入到使用spring boot的images数组中,这是我的存储库接口中的方法

@Modifying
    @Query(value = "update car_wash set images=array_append(images,'' || :item || '') where id =:id",nativeQuery = true)
    void updateImage(@Param("item") String item,@Param("id")Integer id);
但是当我在db中放入一些字符串,如
F:\eclipse\workspace\TestMail\test.txt
时,这个路径用双引号括起来
“F:\eclipse\workspace\TestMail\test.txt”

我不知道为什么,但是当我试图使用这个查询从图像中删除一些字符串时,
updatecar\u wash SET images=array\u remove(图像“,”F:\eclipse\workspace\TestMail\test.txt“)它没有被删除。原因是什么?

我终于找到了答案。我不知道为什么,但是spring将所有路径字符串都用双引号括起来,要解决这个问题,您应该执行以下操作
carWashRepository.updateImage(newImage.getAbsolutePath().replace(“\\”,“/”,carWash.getId())

删除不起作用的原因很可能是双引号不是存储在数据库中的字符串的一部分。为什么字符串包含那些双引号,我说不出来,尤其是在不知道它来自何处的情况下。我只是将文件保存在远程服务器中,并执行以下私有void addImageToCarWash(CarWash CarWash,file newImage){carWashRepository.updateImage(newImage.getAbsolutePath(),CarWash.getId();}Hmm,您可能希望尝试使用
…:项“…
”。由于您正在用Java构建查询,因此不需要字符串连接。还要试着调试代码,看看双引号添加到字符串的位置(
getAbsolutePath()
不应该这样做)。托马斯,我找到了答案,谢谢你的回复