Skip to content

Commit 1de9615

Browse files
committed
Use separate SQLSTATE codes for file not found/file exists, rather than
lumping them into ERRCODE_UNDEFINED_OBJECT/ERRCODE_DUPLICATE_OBJECT. This seems reasonable since 'object' was meant to refer to 'object in the database' and a file is outside the database. Per request from Dave Cramer.
1 parent 0b511f0 commit 1de9615

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

src/backend/utils/error/elog.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
*
3838
*
3939
* IDENTIFICATION
40-
* $Header: /cvsroot/pgsql/src/backend/utils/error/elog.c,v 1.119 2003/08/08 21:42:11 momjian Exp $
40+
* $Header: /cvsroot/pgsql/src/backend/utils/error/elog.c,v 1.120 2003/08/26 21:15:27 tgl Exp $
4141
*
4242
*-------------------------------------------------------------------------
4343
*/
@@ -530,20 +530,20 @@ errcode_for_file_access(void)
530530
edata->sqlerrcode = ERRCODE_INSUFFICIENT_PRIVILEGE;
531531
break;
532532

533-
/* Object not found */
533+
/* File not found */
534534
case ENOENT: /* No such file or directory */
535-
edata->sqlerrcode = ERRCODE_UNDEFINED_OBJECT;
535+
edata->sqlerrcode = ERRCODE_UNDEFINED_FILE;
536536
break;
537537

538-
/* Duplicate object */
538+
/* Duplicate file */
539539
case EEXIST: /* File exists */
540-
edata->sqlerrcode = ERRCODE_DUPLICATE_OBJECT;
540+
edata->sqlerrcode = ERRCODE_DUPLICATE_FILE;
541541
break;
542542

543543
/* Wrong object type or state */
544544
case ENOTDIR: /* Not a directory */
545545
case EISDIR: /* Is a directory */
546-
case ENOTEMPTY: /* Directory not empty */
546+
case ENOTEMPTY: /* Directory not empty */
547547
edata->sqlerrcode = ERRCODE_WRONG_OBJECT_TYPE;
548548
break;
549549

src/include/utils/errcodes.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
*
1212
* Copyright (c) 2003, PostgreSQL Global Development Group
1313
*
14-
* $Id: errcodes.h,v 1.4 2003/08/04 00:43:32 momjian Exp $
14+
* $Id: errcodes.h,v 1.5 2003/08/26 21:15:27 tgl Exp $
1515
*
1616
*-------------------------------------------------------------------------
1717
*/
@@ -294,6 +294,8 @@
294294
/* Class 58 - System Error (class borrowed from DB2) */
295295
/* (we define this as errors external to PostgreSQL itself) */
296296
#define ERRCODE_IO_ERROR MAKE_SQLSTATE('5','8', '0','3','0')
297+
#define ERRCODE_UNDEFINED_FILE MAKE_SQLSTATE('5','8', 'P','0','1')
298+
#define ERRCODE_DUPLICATE_FILE MAKE_SQLSTATE('5','8', 'P','0','2')
297299

298300
/* Class F0 - Configuration File Error (PostgreSQL-specific error class) */
299301
#define ERRCODE_CONFIG_FILE_ERROR MAKE_SQLSTATE('F','0', '0','0','0')

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy