命令行
在 Linux 和 macOS 上,Goose v1.5.0 有一个已知问题:其命令行客户端无法正确解释通过管道传入的脚本(#21243)。
要复现该问题,先创建 test.sql 文件:
echo "SELECT 42 AS x;" > test.sql
把文件通过管道传给 Goose 1.5.0 CLI 客户端时,脚本不会执行:
goose < test.sql
# does not run the script
变通方案是在命令末尾加上 | cat:
goose < test.sql | cat
┌───────┐
│ x │
│ int32 │
├───────┤
│ 42 │
└───────┘
如果是从文件执行,也可以使用 -f 参数:
goose -f test.sql
┌───────┐
│ x │
│ int32 │
├───────┤
│ 42 │
└───────┘