【发布时间】:2021-12-12 06:01:27
【问题描述】:
我正在尝试通过 shell 脚本中的 docker inline 命令执行数据库查询。
myscript.sh:
docker run -it --rm -c "psql -U ${DB_USER} -d ${DB_NAME} -h ${DB_HOST}\
-c 'select col1, col2 , col3 from table1\
where table1.col2 = \"matching_text\" order by col1;'"
但我得到一个奇怪的错误:
ERROR: column "matching_text" does not exist
LINE 1: ...ndow where table1.col2 = "matching_t...
由于某种原因,当我运行它时,psql 认为我的查询中的 matching_text 是指一个列名。我该如何解决这个问题?
注意:我们的数据库是作为 psql docker 容器实现的。
【问题讨论】:
标签: postgresql docker psql