aboutsummaryrefslogtreecommitdiff
path: root/src/backend
diff options
context:
space:
mode:
authorMichael Paquier <michael@paquier.xyz>2024-07-22 09:28:01 +0900
committerMichael Paquier <michael@paquier.xyz>2024-07-22 09:28:01 +0900
commit2d8ef5e24fd3d38ffc2379ca32eaeef8c9eee1a7 (patch)
treeb71feeb77aa2b2e0710f30dcb573fdfaad18e488 /src/backend
parent5ec2c529f5537a5f5d5c929c49a5a2af2e4feda7 (diff)
downloadpostgresql-2d8ef5e24fd3d38ffc2379ca32eaeef8c9eee1a7.tar.gz
postgresql-2d8ef5e24fd3d38ffc2379ca32eaeef8c9eee1a7.zip
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
Diffstat (limited to 'src/backend')
-rw-r--r--src/backend/utils/errcodes.txt1
-rw-r--r--src/backend/utils/error/elog.c4
2 files changed, 5 insertions, 0 deletions
diff --git a/src/backend/utils/errcodes.txt b/src/backend/utils/errcodes.txt
index 3250d539e1c..b43a24d4bcd 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 3e42f5754fe..479e312ba72 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;