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

Commitf9f90b2

Browse files
committed
Improve error message from failed LOAD command (include
kernel's error description when file is not accessible).
1 parentb21005f commitf9f90b2

File tree

2 files changed

+12
-18
lines changed

2 files changed

+12
-18
lines changed

‎src/backend/tcop/utility.c

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
*
1010
*
1111
* IDENTIFICATION
12-
* $Header: /cvsroot/pgsql/src/backend/tcop/utility.c,v 1.59 1999/03/17 22:53:19 momjian Exp $
12+
* $Header: /cvsroot/pgsql/src/backend/tcop/utility.c,v 1.60 1999/05/22 19:49:42 tgl Exp $
1313
*
1414
*-------------------------------------------------------------------------
1515
*/
@@ -612,22 +612,12 @@ ProcessUtility(Node *parsetree,
612612
caseT_LoadStmt:
613613
{
614614
LoadStmt*stmt= (LoadStmt*)parsetree;
615-
FILE*fp;
616-
char*filename;
617615

618616
PS_SET_STATUS(commandTag="LOAD");
619617
CHECK_IF_ABORTED();
620618

621-
filename=stmt->filename;
622-
closeAllVfds();
623-
#ifndef__CYGWIN32__
624-
if ((fp=AllocateFile(filename,"r"))==NULL)
625-
#else
626-
if ((fp=AllocateFile(filename,"rb"))==NULL)
627-
#endif
628-
elog(ERROR,"LOAD: could not open file '%s'",filename);
629-
FreeFile(fp);
630-
load_file(filename);
619+
closeAllVfds();/* probably not necessary... */
620+
load_file(stmt->filename);
631621
}
632622
break;
633623

‎src/backend/utils/fmgr/dfmgr.c

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/backend/utils/fmgr/dfmgr.c,v 1.24 1999/05/10 00:46:13 momjian Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/utils/fmgr/dfmgr.c,v 1.25 1999/05/22 19:49:41 tgl Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -148,7 +148,7 @@ handle_load(char *filename, char *funcname)
148148
if (file_scanner== (DynamicFileList*)NULL)
149149
{
150150
if (stat(filename,&stat_buf)==-1)
151-
elog(ERROR,"stat failed on file%s",filename);
151+
elog(ERROR,"stat failed on file'%s': %m",filename);
152152

153153
for (file_scanner=file_list;
154154
file_scanner!= (DynamicFileList*)NULL
@@ -237,13 +237,17 @@ void
237237
load_file(char*filename)
238238
{
239239
DynamicFileList*file_scanner,
240-
*p;
240+
*p;
241241
structstatstat_buf;
242-
243242
intdone=0;
244243

244+
/*
245+
* We need to do stat() in order to determine whether this is the
246+
* same file as a previously loaded file; it's also handy so as to
247+
* give a good error message if bogus file name given.
248+
*/
245249
if (stat(filename,&stat_buf)==-1)
246-
elog(ERROR,"stat failed onfile%s",filename);
250+
elog(ERROR,"LOAD: could not openfile'%s': %m",filename);
247251

248252
if (file_list!= (DynamicFileList*)NULL
249253
&& !NOT_EQUAL(stat_buf,*file_list))

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp