Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/postgresql/10.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Postgresql Postgres psql\i似乎在添加分号_Postgresql_Psql_Eof - Fatal编程技术网

Postgresql Postgres psql\i似乎在添加分号

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

我正在用postgres教授一门SQL课程。我的一个学生发现了一些我不懂的东西

学生正在使用
\i
命令(即:
\i/temp/query.txt
)将ascii文件中的多个查询提交给psql

一些学生在最后一个命令后省略了分号,但他们仍然从文件中获得了有效的输出

IE
psql
的行为是在文件末尾附加分号

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.
 */