mirror of
https://github.com/postgres/postgres.git
synced 2025-11-18 02:02:55 +03:00
Throw ERROR when publish_generated_columns is specified without a value.
Previously, specifying the publication option 'publish_generated_columns' without an explicit value would incorrectly default to 'stored', which is not the intended behavior. This patch fixes the issue by raising an ERROR when no value is provided for 'publish_generated_columns', ensuring that users must explicitly specify a valid option. Author: Peter Smith <smithpb2250@gmail.com> Reviewed-by: vignesh C <vignesh21@gmail.com> Backpatch-through: 18, where it was introduced Discussion: https://postgr.es/m/CAHut+PsCUCWiEKmB10DxhoPfXbF6jw5RD9ib2LuaQeA_XraW7w@mail.gmail.com
This commit is contained in:
@@ -2113,20 +2113,20 @@ AlterPublicationOwner_oid(Oid pubid, Oid newOwnerId)
|
||||
static char
|
||||
defGetGeneratedColsOption(DefElem *def)
|
||||
{
|
||||
char *sval;
|
||||
char *sval = "";
|
||||
|
||||
/*
|
||||
* If no parameter value given, assume "stored" is meant.
|
||||
* A parameter value is required.
|
||||
*/
|
||||
if (!def->arg)
|
||||
return PUBLISH_GENCOLS_STORED;
|
||||
if (def->arg)
|
||||
{
|
||||
sval = defGetString(def);
|
||||
|
||||
sval = defGetString(def);
|
||||
|
||||
if (pg_strcasecmp(sval, "none") == 0)
|
||||
return PUBLISH_GENCOLS_NONE;
|
||||
if (pg_strcasecmp(sval, "stored") == 0)
|
||||
return PUBLISH_GENCOLS_STORED;
|
||||
if (pg_strcasecmp(sval, "none") == 0)
|
||||
return PUBLISH_GENCOLS_NONE;
|
||||
if (pg_strcasecmp(sval, "stored") == 0)
|
||||
return PUBLISH_GENCOLS_STORED;
|
||||
}
|
||||
|
||||
ereport(ERROR,
|
||||
errcode(ERRCODE_SYNTAX_ERROR),
|
||||
|
||||
Reference in New Issue
Block a user