On Thu, May 6, 2021 at 10:45 AM Dilip Kumar <dilipbal...@gmail.com> wrote:

I noticed that the error code for invalid compression method is not
perfect, basically when we pass the invalid compression method during
CREATE/ALTER table that time we give
ERRCODE_FEATURE_NOT_SUPPORTED.  I think the correct error code is
ERRCODE_INVALID_PARAMETER_VALUE.  I have attached a patch to fix this.

I thought of starting a new thread first but then I thought the
subject of this thread is quite generic and this is a fairly small fix
so we can use the same thread.

-- 
Regards,
Dilip Kumar
EnterpriseDB: http://www.enterprisedb.com
From f09e9940772c6d493624268b776931633c882c7d Mon Sep 17 00:00:00 2001
From: Dilip Kumar <dilipkumar@localhost.localdomain>
Date: Thu, 6 May 2021 15:13:06 +0530
Subject: [PATCH] Fix thinko in invalid compression error code

---
 src/backend/commands/tablecmds.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c
index d9ba87a..7351b78 100644
--- a/src/backend/commands/tablecmds.c
+++ b/src/backend/commands/tablecmds.c
@@ -18491,7 +18491,7 @@ GetAttributeCompression(Form_pg_attribute att, char *compression)
 	cmethod = CompressionNameToMethod(compression);
 	if (!CompressionMethodIsValid(cmethod))
 		ereport(ERROR,
-				(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
 				 errmsg("invalid compression method \"%s\"", compression)));
 
 	return cmethod;
-- 
1.8.3.1

Reply via email to