Skip to content

Commit 2d8ef5e

Browse files
committed
Add new error code for "file name too long"
This new error code, named file_name_too_long, maps internally to the errno ENAMETOOLONG to produce a proper error code rather than an internal code under errcode_for_file_access(). This error code can be reached with some SQL command patterns, like a snapshot file name. Reported-by: Alexander Lakhin Reviewed-by: Daniel Gustafsson Discussion: https://postgr.es/m/Zo4ROR9mgy8bowMo@paquier.xyz
1 parent 5ec2c52 commit 2d8ef5e

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

src/backend/utils/errcodes.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -439,6 +439,7 @@ Section: Class 58 - System Error (errors external to PostgreSQL itself)
439439
58030 E ERRCODE_IO_ERROR io_error
440440
58P01 E ERRCODE_UNDEFINED_FILE undefined_file
441441
58P02 E ERRCODE_DUPLICATE_FILE duplicate_file
442+
58P03 E ERRCODE_FILE_NAME_TOO_LONG file_name_too_long
442443

443444
Section: Class F0 - Configuration File Error
444445

src/backend/utils/error/elog.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -929,6 +929,10 @@ errcode_for_file_access(void)
929929
edata->sqlerrcode = ERRCODE_IO_ERROR;
930930
break;
931931

932+
case ENAMETOOLONG: /* File name too long */
933+
edata->sqlerrcode = ERRCODE_FILE_NAME_TOO_LONG;
934+
break;
935+
932936
/* All else is classified as internal errors */
933937
default:
934938
edata->sqlerrcode = ERRCODE_INTERNAL_ERROR;

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