From a4d5284a10b5096585f1bbf1bf723954e9d6c2e0 Mon Sep 17 00:00:00 2001 From: Robert Haas Date: Mon, 22 Mar 2021 10:57:08 -0400 Subject: Error on invalid TOAST compression in CREATE or ALTER TABLE. The previous coding treated an invalid compression method name as equivalent to the default, which is certainly not right. Justin Pryzby Discussion: http://postgr.es/m/20210321235544.GD4203@telsasoft.com --- src/backend/commands/tablecmds.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'src/backend/commands/tablecmds.c') diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c index 22f3c5efc09..54fea31e43f 100644 --- a/src/backend/commands/tablecmds.c +++ b/src/backend/commands/tablecmds.c @@ -17863,9 +17863,13 @@ GetAttributeCompression(Form_pg_attribute att, char *compression) /* fallback to default compression if it's not specified */ if (compression == NULL) - cmethod = GetDefaultToastCompression(); - else - cmethod = CompressionNameToMethod(compression); + return GetDefaultToastCompression(); + + cmethod = CompressionNameToMethod(compression); + if (!CompressionMethodIsValid(cmethod)) + ereport(ERROR, + (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), + errmsg("invalid compression method \"%s\"", compression))); return cmethod; } -- cgit v1.2.3