Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitb291c0f

Browse files
committed
psql -f -
Adjust psql -f - to behave like a normal file and honor the -1 flag.Report from Robert Haas
1 parent0d32342 commitb291c0f

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

‎src/bin/psql/command.c

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
*
44
* Copyright (c) 2000-2009, PostgreSQL Global Development Group
55
*
6-
* $PostgreSQL: pgsql/src/bin/psql/command.c,v 1.211 2009/11/22 05:20:41 tgl Exp $
6+
* $PostgreSQL: pgsql/src/bin/psql/command.c,v 1.212 2009/12/01 22:34:33 momjian Exp $
77
*/
88
#include"postgres_fe.h"
99
#include"command.h"
@@ -1691,8 +1691,13 @@ process_file(char *filename, bool single_txn)
16911691
if (!filename)
16921692
returnEXIT_FAILURE;
16931693

1694-
canonicalize_path(filename);
1695-
fd=fopen(filename,PG_BINARY_R);
1694+
if (strcmp(filename,"-")!=0)
1695+
{
1696+
canonicalize_path(filename);
1697+
fd=fopen(filename,PG_BINARY_R);
1698+
}
1699+
else
1700+
fd=stdin;
16961701

16971702
if (!fd)
16981703
{

‎src/bin/psql/startup.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
*
44
* Copyright (c) 2000-2009, PostgreSQL Global Development Group
55
*
6-
* $PostgreSQL: pgsql/src/bin/psql/startup.c,v 1.156 2009/04/05 04:19:58 tgl Exp $
6+
* $PostgreSQL: pgsql/src/bin/psql/startup.c,v 1.157 2009/12/01 22:34:33 momjian Exp $
77
*/
88
#include"postgres_fe.h"
99

@@ -225,7 +225,7 @@ main(int argc, char *argv[])
225225
/*
226226
* process file given by -f
227227
*/
228-
if (options.action==ACT_FILE&&strcmp(options.action_string,"-")!=0)
228+
if (options.action==ACT_FILE)
229229
{
230230
if (!options.no_psqlrc)
231231
process_psqlrc(argv[0]);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp