Postgresql Postgres psql\i似乎在添加分号
我正在用postgres教授一门SQL课程。我的一个学生发现了一些我不懂的东西 学生正在使用Postgresql Postgres psql\i似乎在添加分号,postgresql,psql,eof,Postgresql,Psql,Eof,我正在用postgres教授一门SQL课程。我的一个学生发现了一些我不懂的东西 学生正在使用\i命令(即:\i/temp/query.txt)将ascii文件中的多个查询提交给psql 一些学生在最后一个命令后省略了分号,但他们仍然从文件中获得了有效的输出 IEpsql的行为是在文件末尾附加分号 Postgres是否接受分号或EOF作为命令的结尾?或者这里是否发生了其他事情 (我在Windows上看到过这一点。还没有在Unix下查看过)Postgres V 13.2来自sourcesrc/bin
\i
命令(即:\i/temp/query.txt
)将ascii文件中的多个查询提交给psql
一些学生在最后一个命令后省略了分号,但他们仍然从文件中获得了有效的输出
IEpsql
的行为是在文件末尾附加分号
Postgres是否接受分号或EOF作为命令的结尾?或者这里是否发生了其他事情
(我在Windows上看到过这一点。还没有在Unix下查看过)Postgres V 13.2来自source
src/bin/psql/mainloop.c
:
/*
* If we have a non-semicolon-terminated query at the end of file, we
* process it unless the input source is interactive --- in that case it
* seems better to go ahead and quit. Also skip if this is an error exit.
*/
从source
src/bin/psql/mainloop.c
:
/*
* If we have a non-semicolon-terminated query at the end of file, we
* process it unless the input source is interactive --- in that case it
* seems better to go ahead and quit. Also skip if this is an error exit.
*/