File tree Expand file tree Collapse file tree 2 files changed +26
-2
lines changed
Expand file tree Collapse file tree 2 files changed +26
-2
lines changed Original file line number Diff line number Diff line change 1313 *
1414 *
1515 * IDENTIFICATION
16- * $PostgreSQL: pgsql/src/backend/commands/dbcommands.c,v 1.218 2009/01/20 18:59:37 heikki Exp $
16+ * $PostgreSQL: pgsql/src/backend/commands/dbcommands.c,v 1.219 2009/01/30 17:24:47 heikki Exp $
1717 *
1818 *-------------------------------------------------------------------------
1919 */
@@ -244,7 +244,13 @@ createdb(const CreatedbStmt *stmt)
244244 dbctype = strVal (dctype -> arg );
245245
246246 if (dconnlimit && dconnlimit -> arg )
247+ {
247248 dbconnlimit = intVal (dconnlimit -> arg );
249+ if (dbconnlimit < -1 )
250+ ereport (ERROR ,
251+ (errcode (ERRCODE_INVALID_PARAMETER_VALUE ),
252+ errmsg ("invalid connection limit: %d" , dbconnlimit )));
253+ }
248254
249255 /* obtain OID of proposed owner */
250256 if (dbowner )
@@ -1319,7 +1325,13 @@ AlterDatabase(AlterDatabaseStmt *stmt, bool isTopLevel)
13191325 }
13201326
13211327 if (dconnlimit )
1328+ {
13221329 connlimit = intVal (dconnlimit -> arg );
1330+ if (connlimit < -1 )
1331+ ereport (ERROR ,
1332+ (errcode (ERRCODE_INVALID_PARAMETER_VALUE ),
1333+ errmsg ("invalid connection limit: %d" , connlimit )));
1334+ }
13231335
13241336 /*
13251337 * Get the old tuple. We don't need a lock on the database per se,
Original file line number Diff line number Diff line change 66 * Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group
77 * Portions Copyright (c) 1994, Regents of the University of California
88 *
9- * $PostgreSQL: pgsql/src/backend/commands/user.c,v 1.185 2009/01/22 20:16:02 tgl Exp $
9+ * $PostgreSQL: pgsql/src/backend/commands/user.c,v 1.186 2009/01/30 17:24:47 heikki Exp $
1010 *
1111 *-------------------------------------------------------------------------
1212 */
@@ -242,7 +242,13 @@ CreateRole(CreateRoleStmt *stmt)
242242 if (dcanlogin )
243243 canlogin = intVal (dcanlogin -> arg ) != 0 ;
244244 if (dconnlimit )
245+ {
245246 connlimit = intVal (dconnlimit -> arg );
247+ if (connlimit < -1 )
248+ ereport (ERROR ,
249+ (errcode (ERRCODE_INVALID_PARAMETER_VALUE ),
250+ errmsg ("invalid connection limit: %d" , connlimit )));
251+ }
246252 if (daddroleto )
247253 addroleto = (List * ) daddroleto -> arg ;
248254 if (drolemembers )
@@ -533,7 +539,13 @@ AlterRole(AlterRoleStmt *stmt)
533539 if (dcanlogin )
534540 canlogin = intVal (dcanlogin -> arg );
535541 if (dconnlimit )
542+ {
536543 connlimit = intVal (dconnlimit -> arg );
544+ if (connlimit < -1 )
545+ ereport (ERROR ,
546+ (errcode (ERRCODE_INVALID_PARAMETER_VALUE ),
547+ errmsg ("invalid connection limit: %d" , connlimit )));
548+ }
537549 if (drolemembers )
538550 rolemembers = (List * ) drolemembers -> arg ;
539551 if (dvalidUntil )
You can’t perform that action at this time.
0 commit comments