1010 * Written by Peter Eisentraut <peter_e@gmx.net>.
1111 *
1212 * IDENTIFICATION
13- * $PostgreSQL: pgsql/src/backend/utils/misc/guc.c,v 1.198 2004/04/0705:05:50 momjian Exp $
13+ * $PostgreSQL: pgsql/src/backend/utils/misc/guc.c,v 1.199 2004/04/0718:52:26 momjian Exp $
1414 *
1515 *--------------------------------------------------------------------
1616 */
@@ -2730,13 +2730,12 @@ set_config_option(const char *name, const char *value,
27302730name )));
27312731return false;
27322732}
2733- if (record -> context == PGC_USERLIMIT &&
2734- IsUnderPostmaster && !superuser ())
2733+ if (record -> context == PGC_USERLIMIT )
27352734{
27362735if (newval < conf -> reset_val )
27372736{
27382737/* Limit non-superuser changes */
2739- if (source > PGC_S_UNPRIVILEGED )
2738+ if (source > PGC_S_UNPRIVILEGED && ! superuser () )
27402739{
27412740ereport (elevel ,
27422741(errcode (ERRCODE_INSUFFICIENT_PRIVILEGE ),
@@ -2750,7 +2749,8 @@ set_config_option(const char *name, const char *value,
27502749{
27512750/* Allow change if admin should override */
27522751if (source < PGC_S_UNPRIVILEGED &&
2753- record -> source > PGC_S_UNPRIVILEGED )
2752+ record -> source > PGC_S_UNPRIVILEGED &&
2753+ !superuser ())
27542754changeVal = changeValOrig ;
27552755}
27562756}
@@ -2830,16 +2830,15 @@ set_config_option(const char *name, const char *value,
28302830newval ,name ,conf -> min ,conf -> max )));
28312831return false;
28322832}
2833- if (record -> context == PGC_USERLIMIT &&
2834- IsUnderPostmaster && !superuser ())
2833+ if (record -> context == PGC_USERLIMIT )
28352834{
28362835/* handle log_min_duration_statement, -1=disable */
28372836if ((newval != -1 && conf -> reset_val != -1 &&
28382837newval > conf -> reset_val )|| /* increase duration */
28392838 (newval == -1 && conf -> reset_val != -1 ))/* turn off */
28402839{
28412840/* Limit non-superuser changes */
2842- if (source > PGC_S_UNPRIVILEGED )
2841+ if (source > PGC_S_UNPRIVILEGED && ! superuser () )
28432842{
28442843ereport (elevel ,
28452844(errcode (ERRCODE_INSUFFICIENT_PRIVILEGE ),
@@ -2855,7 +2854,8 @@ set_config_option(const char *name, const char *value,
28552854(newval != -1 && * conf -> variable == -1 ))/* turn on */
28562855{
28572856if (source < PGC_S_UNPRIVILEGED &&
2858- record -> source > PGC_S_UNPRIVILEGED )
2857+ record -> source > PGC_S_UNPRIVILEGED &&
2858+ !superuser ())
28592859changeVal = changeValOrig ;
28602860}
28612861}
@@ -2935,12 +2935,11 @@ set_config_option(const char *name, const char *value,
29352935newval ,name ,conf -> min ,conf -> max )));
29362936return false;
29372937}
2938- if (record -> context == PGC_USERLIMIT &&
2939- IsUnderPostmaster && !superuser ())
2938+ if (record -> context == PGC_USERLIMIT )
29402939/* No REAL PGC_USERLIMIT */
29412940{
29422941/* Limit non-superuser changes */
2943- if (source > PGC_S_UNPRIVILEGED )
2942+ if (source > PGC_S_UNPRIVILEGED && ! superuser () )
29442943{
29452944ereport (elevel ,
29462945(errcode (ERRCODE_INSUFFICIENT_PRIVILEGE ),
@@ -2951,7 +2950,8 @@ set_config_option(const char *name, const char *value,
29512950}
29522951/* Allow change if admin should override */
29532952if (source < PGC_S_UNPRIVILEGED &&
2954- record -> source > PGC_S_UNPRIVILEGED )
2953+ record -> source > PGC_S_UNPRIVILEGED &&
2954+ !superuser ())
29552955changeVal = false;
29562956}
29572957}
@@ -3023,8 +3023,7 @@ set_config_option(const char *name, const char *value,
30233023return false;
30243024}
30253025
3026- if (record -> context == PGC_USERLIMIT &&
3027- IsUnderPostmaster && !superuser ())
3026+ if (record -> context == PGC_USERLIMIT )
30283027{
30293028int var_value ,reset_value ,new_value ;
30303029const char * (* var_hook ) (int * var ,const char * newval ,
@@ -3045,7 +3044,7 @@ set_config_option(const char *name, const char *value,
30453044if (new_value > reset_value )
30463045{
30473046/* Limit non-superuser changes */
3048- if (source > PGC_S_UNPRIVILEGED )
3047+ if (source > PGC_S_UNPRIVILEGED && ! superuser () )
30493048{
30503049ereport (elevel ,
30513050(errcode (ERRCODE_INSUFFICIENT_PRIVILEGE ),
@@ -3060,7 +3059,8 @@ set_config_option(const char *name, const char *value,
30603059if (new_value < var_value )
30613060{
30623061if (source < PGC_S_UNPRIVILEGED &&
3063- record -> source > PGC_S_UNPRIVILEGED )
3062+ record -> source > PGC_S_UNPRIVILEGED &&
3063+ !superuser ())
30643064changeVal = changeValOrig ;
30653065}
30663066}