Adjust psql -f - to behave like a normal file and honor the -1 flag.
Report from Robert Haas
*
* Copyright (c) 2000-2009, PostgreSQL Global Development Group
*
- * $PostgreSQL: pgsql/src/bin/psql/command.c,v 1.211 2009/11/22 05:20:41 tgl Exp $
+ * $PostgreSQL: pgsql/src/bin/psql/command.c,v 1.212 2009/12/01 22:34:33 momjian Exp $
*/
#include "postgres_fe.h"
#include "command.h"
if (!filename)
return EXIT_FAILURE;
- canonicalize_path(filename);
- fd = fopen(filename, PG_BINARY_R);
+ if (strcmp(filename, "-") != 0)
+ {
+ canonicalize_path(filename);
+ fd = fopen(filename, PG_BINARY_R);
+ }
+ else
+ fd = stdin;
if (!fd)
{
*
* Copyright (c) 2000-2009, PostgreSQL Global Development Group
*
- * $PostgreSQL: pgsql/src/bin/psql/startup.c,v 1.156 2009/04/05 04:19:58 tgl Exp $
+ * $PostgreSQL: pgsql/src/bin/psql/startup.c,v 1.157 2009/12/01 22:34:33 momjian Exp $
*/
#include "postgres_fe.h"
/*
* process file given by -f
*/
- if (options.action == ACT_FILE && strcmp(options.action_string, "-") != 0)
+ if (options.action == ACT_FILE)
{
if (!options.no_psqlrc)
process_psqlrc(argv[0]);