On Tue, Mar 13, 2007 at 08:22:17AM +0000, Gregory Stark wrote: > The code seems to assume that all custom variables are strings. There are > about half a dozen Assert(variable->vartype == PGC_STRING) throughout the > patch. That's not true, plperl's use_strict is a boolean and we have > DefineCustome*Variable functions for each type of variable. Perl bombs > because plperl.use_strict is a boolean.
The attached patch removes those Asserts. But this is not the whole story. I wonder why setting "plperl.use_strict" is supposed to work at all? Where is the corresponding definition of "plperl" as a custom variable class? I can add it manually to postgresql.conf and make the regression tests work but is this the intended way? Joachim
Index: src/backend/utils/misc/guc.c =================================================================== RCS file: /projects/cvsroot/pgsql/src/backend/utils/misc/guc.c,v retrieving revision 1.380 diff -c -r1.380 guc.c *** src/backend/utils/misc/guc.c 12 Mar 2007 22:09:28 -0000 1.380 --- src/backend/utils/misc/guc.c 13 Mar 2007 10:03:26 -0000 *************** *** 2658,2678 **** gen = guc_variables[idx]; - /* - * Even though this function could delete other types of variables as well, - * at the moment we only call it for custom variables that always have type - * string. - */ Assert(gen->group == CUSTOM_OPTIONS); - Assert(gen->vartype == PGC_STRING); ! conf = (struct config_string *) gen; ! set_string_field(conf, &conf->reset_val, NULL); ! set_string_field(conf, &conf->tentative_val, NULL); ! for (stack = conf->gen.stack; stack; stack = prev) { ! set_string_field(conf, &stack->tentative_val.stringval, NULL); ! set_string_field(conf, &stack->value.stringval, NULL); prev = stack->prev; pfree(stack); } --- 2658,2678 ---- gen = guc_variables[idx]; Assert(gen->group == CUSTOM_OPTIONS); ! if (gen->vartype == PGC_STRING) ! { ! conf = (struct config_string *) gen; ! set_string_field(conf, &conf->reset_val, NULL); ! set_string_field(conf, &conf->tentative_val, NULL); ! } ! for (stack = gen->stack; stack; stack = prev) { ! if (gen->vartype == PGC_STRING) ! { ! set_string_field(conf, &stack->tentative_val.stringval, NULL); ! set_string_field(conf, &stack->value.stringval, NULL); ! } prev = stack->prev; pfree(stack); } *************** *** 2698,2706 **** gen = guc_variables[idx]; Assert(gen->group == CUSTOM_OPTIONS); - Assert(gen->vartype == PGC_STRING); - - conf = (struct config_string *) gen; /* * Here we check whether it is safe to really delete the variable --- 2698,2703 ---- *************** *** 2723,2731 **** * then been deleted from the configuration file should behave * as if it had been introduced in the session. */ - Assert(gen->vartype == PGC_STRING); gen->reset_source = PGC_S_DEFAULT; ! set_string_field(conf, &conf->reset_val, NULL); } else guc_delete_variable(name); --- 2720,2731 ---- * then been deleted from the configuration file should behave * as if it had been introduced in the session. */ gen->reset_source = PGC_S_DEFAULT; ! if (gen->vartype == PGC_STRING) ! { ! conf = (struct config_string *) gen; ! set_string_field(conf, &conf->reset_val, NULL); ! } } else guc_delete_variable(name);
---------------------------(end of broadcast)--------------------------- TIP 9: In versions below 8.0, the planner will ignore your desire to choose an index scan if your joining column's datatypes do not match