尝试在 psql 中使用“\i [文件名]”,得到“无效参数”

sig*_*gil 3 postgresql psql

C:\Users\myname\some path\query.sql使用 Windows 10、Postgres 11。我有一个包含典型 SELECT 查询的文件:

select a.id,m.toagentid,m.maxstart from agent a
left join
mostrecentfromtopair m 
on
a.id=m.fromagentid
Run Code Online (Sandbox Code Playgroud)

当我在psql终端中时,我尝试按如下方式运行此查询:

\i "C:\Users\myname\some path\query.sql"
Run Code Online (Sandbox Code Playgroud)

然后我得到这个错误:

\i: Invalid argument
Run Code Online (Sandbox Code Playgroud)

我应该如何运行这个 .SQL 文件?

JGH*_*JGH 10

您可以使用单引号和斜杠:

\i 'C:/Users/myname/some path/query.sql'
Run Code Online (Sandbox Code Playgroud)