]> granicus.if.org Git - postgresql/commitdiff
Use separate SQLSTATE codes for file not found/file exists, rather than
authorTom Lane <tgl@sss.pgh.pa.us>
Tue, 26 Aug 2003 21:15:27 +0000 (21:15 +0000)
committerTom Lane <tgl@sss.pgh.pa.us>
Tue, 26 Aug 2003 21:15:27 +0000 (21:15 +0000)
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.

src/backend/utils/error/elog.c
src/include/utils/errcodes.h

index 0a4d85436d107bbe985b8663a0e35108b74e7edc..15d6a1bb68d65838ab2a15d0de9a6239500e94a2 100644 (file)
@@ -37,7 +37,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/utils/error/elog.c,v 1.119 2003/08/08 21:42:11 momjian Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/utils/error/elog.c,v 1.120 2003/08/26 21:15:27 tgl Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -530,20 +530,20 @@ errcode_for_file_access(void)
                        edata->sqlerrcode = ERRCODE_INSUFFICIENT_PRIVILEGE;
                        break;
 
-                       /* Object not found */
+                       /* File not found */
                case ENOENT:                    /* No such file or directory */
-                       edata->sqlerrcode = ERRCODE_UNDEFINED_OBJECT;
+                       edata->sqlerrcode = ERRCODE_UNDEFINED_FILE;
                        break;
 
-                       /* Duplicate object */
+                       /* Duplicate file */
                case EEXIST:                    /* File exists */
-                       edata->sqlerrcode = ERRCODE_DUPLICATE_OBJECT;
+                       edata->sqlerrcode = ERRCODE_DUPLICATE_FILE;
                        break;
 
                        /* Wrong object type or state */
                case ENOTDIR:                   /* Not a directory */
                case EISDIR:                    /* Is a directory */
-               case ENOTEMPTY: /* Directory not empty */
+               case ENOTEMPTY:                 /* Directory not empty */
                        edata->sqlerrcode = ERRCODE_WRONG_OBJECT_TYPE;
                        break;
 
index 8db8e52320ca4af1d3af4e51ae4b43b3956eaba6..13e42cf1b9d87ff59ab746baad5fb3680e734324 100644 (file)
@@ -11,7 +11,7 @@
  *
  * Copyright (c) 2003, PostgreSQL Global Development Group
  *
- * $Id: errcodes.h,v 1.4 2003/08/04 00:43:32 momjian Exp $
+ * $Id: errcodes.h,v 1.5 2003/08/26 21:15:27 tgl Exp $
  *
  *-------------------------------------------------------------------------
  */
 /* Class 58 - System Error (class borrowed from DB2) */
 /* (we define this as errors external to PostgreSQL itself) */
 #define ERRCODE_IO_ERROR                                       MAKE_SQLSTATE('5','8', '0','3','0')
+#define ERRCODE_UNDEFINED_FILE                         MAKE_SQLSTATE('5','8', 'P','0','1')
+#define ERRCODE_DUPLICATE_FILE                         MAKE_SQLSTATE('5','8', 'P','0','2')
 
 /* Class F0 - Configuration File Error (PostgreSQL-specific error class) */
 #define ERRCODE_CONFIG_FILE_ERROR                      MAKE_SQLSTATE('F','0', '0','0','0')