尝试使用“\i [文件名]";在 psql 中,获取“无效参数"; [英] Trying to use "\i [filename]" in psql, getting "invalid argument"

查看:65
本文介绍了尝试使用“\i [文件名]";在 psql 中,获取“无效参数";的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

Using Windows 10, Postgres 11. I have a file C:\Users\myname\some path\query.sql containing a typical SELECT query:

select a.id,m.toagentid,m.maxstart from agent a
left join
mostrecentfromtopair m 
on
a.id=m.fromagentid

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

When I'm in the psql terminal, and I try to run this query as follows:

\i "C:\Users\myname\some path\query.sql"

然后我收到此错误:

\i: Invalid argument

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

How should I be running this .SQL file?

推荐答案

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

You can use single quotes and slashes:

\i 'C:/Users/myname/some path/query.sql'

这篇关于尝试使用“\i [文件名]";在 psql 中,获取“无效参数";的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆