It's missing in older versions too, but it doesn't seem worth
back-porting. All negative are just harmlessly treated as "no limit", and
tightening the check might even brake an application that relies on it.
dbctype = strVal(dctype->arg);
if (dconnlimit && dconnlimit->arg)
+ {
dbconnlimit = intVal(dconnlimit->arg);
+ if (dbconnlimit < -1)
+ ereport(ERROR,
+ (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+ errmsg("invalid connection limit: %d", dbconnlimit)));
+ }
/* obtain OID of proposed owner */
if (dbowner)
}
if (dconnlimit)
+ {
connlimit = intVal(dconnlimit->arg);
+ if (connlimit < -1)
+ ereport(ERROR,
+ (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+ errmsg("invalid connection limit: %d", connlimit)));
+ }
/*
* Get the old tuple. We don't need a lock on the database per se,
if (dcanlogin)
canlogin = intVal(dcanlogin->arg) != 0;
if (dconnlimit)
+ {
connlimit = intVal(dconnlimit->arg);
+ if (connlimit < -1)
+ ereport(ERROR,
+ (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+ errmsg("invalid connection limit: %d", connlimit)));
+ }
if (daddroleto)
addroleto = (List *) daddroleto->arg;
if (drolemembers)
if (dcanlogin)
canlogin = intVal(dcanlogin->arg);
if (dconnlimit)
+ {
connlimit = intVal(dconnlimit->arg);
+ if (connlimit < -1)
+ ereport(ERROR,
+ (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+ errmsg("invalid connection limit: %d", connlimit)));
+ }
if (drolemembers)
rolemembers = (List *) drolemembers->arg;
if (dvalidUntil)