errno-nametoolong.patch

text/x-diff

Filename: errno-nametoolong.patch
Type: text/x-diff
Part: 0
Message: Re: Internal error codes triggered by tests

Patch

Same data as JSON: GET /api/v1/attachments/:id/patch the parsed metadata as JSON — format, series position, per-file stats; never the diff bytes. API reference →
Format: unified
File+
src/backend/utils/errcodes.txt 1 0
src/backend/utils/error/elog.c 4 0
diff --git a/src/backend/utils/errcodes.txt b/src/backend/utils/errcodes.txt
index 3250d539e1..b43a24d4bc 100644
--- a/src/backend/utils/errcodes.txt
+++ b/src/backend/utils/errcodes.txt
@@ -439,6 +439,7 @@ Section: Class 58 - System Error (errors external to PostgreSQL itself)
 58030    E    ERRCODE_IO_ERROR                                               io_error
 58P01    E    ERRCODE_UNDEFINED_FILE                                         undefined_file
 58P02    E    ERRCODE_DUPLICATE_FILE                                         duplicate_file
+58P03    E    ERRCODE_FILE_NAME_TOO_LONG                                     file_name_too_long
 
 Section: Class F0 - Configuration File Error
 
diff --git a/src/backend/utils/error/elog.c b/src/backend/utils/error/elog.c
index 3e42f5754f..479e312ba7 100644
--- a/src/backend/utils/error/elog.c
+++ b/src/backend/utils/error/elog.c
@@ -929,6 +929,10 @@ errcode_for_file_access(void)
 			edata->sqlerrcode = ERRCODE_IO_ERROR;
 			break;
 
+		case ENAMETOOLONG:		/* File name too long */
+			edata->sqlerrcode = ERRCODE_FILE_NAME_TOO_LONG;
+			break;
+
 			/* All else is classified as internal errors */
 		default:
 			edata->sqlerrcode = ERRCODE_INTERNAL_ERROR;