diff options
author | Robert Haas <rhaas@postgresql.org> | 2021-03-22 10:57:08 -0400 |
---|---|---|
committer | Robert Haas <rhaas@postgresql.org> | 2021-03-22 10:57:08 -0400 |
commit | a4d5284a10b5096585f1bbf1bf723954e9d6c2e0 (patch) | |
tree | db01e0441fce821baf4ecb82ff56d565becd1b2a /src/backend/commands/tablecmds.c | |
parent | 24f0e395ac5892cd12e8914646fe921fac5ba23d (diff) |
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
Diffstat (limited to 'src/backend/commands/tablecmds.c')
-rw-r--r-- | src/backend/commands/tablecmds.c | 10 |
1 files changed, 7 insertions, 3 deletions
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; } |