1
0
mirror of https://github.com/postgres/postgres.git synced 2025-11-06 07:49:08 +03:00

Improve error message from failed LOAD command (include

kernel's error description when file is not accessible).
This commit is contained in:
Tom Lane
1999-05-22 19:49:42 +00:00
parent b21005fa7c
commit f9f90b21b2
2 changed files with 12 additions and 18 deletions

View File

@@ -9,7 +9,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/tcop/utility.c,v 1.59 1999/03/17 22:53:19 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/tcop/utility.c,v 1.60 1999/05/22 19:49:42 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -612,22 +612,12 @@ ProcessUtility(Node *parsetree,
case T_LoadStmt:
{
LoadStmt *stmt = (LoadStmt *) parsetree;
FILE *fp;
char *filename;
PS_SET_STATUS(commandTag = "LOAD");
CHECK_IF_ABORTED();
filename = stmt->filename;
closeAllVfds();
#ifndef __CYGWIN32__
if ((fp = AllocateFile(filename, "r")) == NULL)
#else
if ((fp = AllocateFile(filename, "rb")) == NULL)
#endif
elog(ERROR, "LOAD: could not open file '%s'", filename);
FreeFile(fp);
load_file(filename);
closeAllVfds(); /* probably not necessary... */
load_file(stmt->filename);
}
break;