使用外部编辑器的命令行中的Postgres未运行查询 [英] Postgres on the command line with external editor not running query
本文介绍了使用外部编辑器的命令行中的Postgres未运行查询的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
登录到 psql
命令行工具并在命令行上运行 \e
时,我的默认设置编辑器,崇高的文字,按时打开。但是,当我输入这样的查询时:
When I run \e
on the command line while logged into the psql
command line tool, my default editor, sublime text, duitifully opens. However, when I type in a query like this:
create table tutorials (
tutorial_id serial primary key,
title text,
author_id integer references authors(author_id)
);
然后按保存并退出,什么也没有发生!我的查询未运行。我究竟做错了什么?我该如何解决呢?
Then hit save and exit, nothing happens! My query is not run. What am I doing wrong? How do I fix this?
推荐答案
在添加-w开关以导出EDITOR之前,我遇到了类似的问题。
I had a similar problem until I added the -w switch to export EDITOR.
来自 http:// www .sublimetext.com / docs / 3 / osx_command_line.html :
- 要使用Sublime Text作为许多命令的编辑器提示输入
时,设置您的EDITOR环境变量: - export EDITOR ='subl -w'
- 指定-w将导致subl命令在文件
关闭之前不退出。
这篇关于使用外部编辑器的命令行中的Postgres未运行查询的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文