Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit1dbe6f7

Browse files
committed
Refactor non-supported compression error message in toast_compression.c
This code used a NO_LZ4_SUPPORT() macro to issue an error in the codepaths where LZ4 [de]compression is attempted but the build does notsupport it. This commit refactors the code to use a more flexible errormessage so as it can be used for other compression methods, where themethod is given in input of macro.Extracted from a larger patch by the same author.Author: Nikhil Kumar Veldanda <veldanda.nikhilkumar17@gmail.com>Reviewed-by: Kirill Reshke <reshkekirill@gmail.com>Discussion:https://postgr.es/m/CAFAfj_HX84EK4hyRYw50AOHOcdVi-+FFwAAPo7JHx4aShCvunQ@mail.gmail.com
1 parentb8341ae commit1dbe6f7

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

‎src/backend/access/common/toast_compression.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,11 @@
2525
/* GUC */
2626
intdefault_toast_compression=TOAST_PGLZ_COMPRESSION;
2727

28-
#defineNO_LZ4_SUPPORT() \
28+
#defineNO_COMPRESSION_SUPPORT(method) \
2929
ereport(ERROR, \
3030
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED), \
31-
errmsg("compression methodlz4 not supported"), \
32-
errdetail("This functionality requires the server to be built withlz4 support.")))
31+
errmsg("compression method%s not supported", method), \
32+
errdetail("This functionality requires the server to be built with%s support.", method)))
3333

3434
/*
3535
* Compress a varlena using PGLZ.
@@ -139,7 +139,7 @@ struct varlena *
139139
lz4_compress_datum(conststructvarlena*value)
140140
{
141141
#ifndefUSE_LZ4
142-
NO_LZ4_SUPPORT();
142+
NO_COMPRESSION_SUPPORT("lz4");
143143
returnNULL;/* keep compiler quiet */
144144
#else
145145
int32valsize;
@@ -182,7 +182,7 @@ struct varlena *
182182
lz4_decompress_datum(conststructvarlena*value)
183183
{
184184
#ifndefUSE_LZ4
185-
NO_LZ4_SUPPORT();
185+
NO_COMPRESSION_SUPPORT("lz4");
186186
returnNULL;/* keep compiler quiet */
187187
#else
188188
int32rawsize;
@@ -215,7 +215,7 @@ struct varlena *
215215
lz4_decompress_datum_slice(conststructvarlena*value,int32slicelength)
216216
{
217217
#ifndefUSE_LZ4
218-
NO_LZ4_SUPPORT();
218+
NO_COMPRESSION_SUPPORT("lz4");
219219
returnNULL;/* keep compiler quiet */
220220
#else
221221
int32rawsize;
@@ -289,7 +289,7 @@ CompressionNameToMethod(const char *compression)
289289
elseif (strcmp(compression,"lz4")==0)
290290
{
291291
#ifndefUSE_LZ4
292-
NO_LZ4_SUPPORT();
292+
NO_COMPRESSION_SUPPORT("lz4");
293293
#endif
294294
returnTOAST_LZ4_COMPRESSION;
295295
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp