Unix Technical Forum

Fix that deals with unusable custom variables.

This is a discussion on Fix that deals with unusable custom variables. within the Pgsql Patches forums, part of the PostgreSQL category; --> This is a bit embarrassing but the patch I submitted that enables custom variable classes (8-10 months ago) was ...


Go Back   Unix Technical Forum > Database Server Software > PostgreSQL > Pgsql Patches

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-18-2008, 12:09 AM
Thomas Hallgren
 
Posts: n/a
Default Fix that deals with unusable custom variables.

This is a bit embarrassing but the patch I submitted that enables custom
variable classes (8-10 months ago) was somewhat incomplete. The
DefineCustomIntVariable and DefineCustomRealVariable functions doesn't
have parameters that make it possible to set the min and max values of
the variables. Consequently, custom variables of int and real type are
completely useless. This patch adds the additional parameters minValue
and maxValue to those functions.

No one but me have used this so far (or someone would have noticed) so I
think it would be safe to backport this for 8.0.2.

Regards,
Thomas Hallgren


Index: src/backend/utils/misc/guc.c
================================================== =================
RCS file: /projects/cvsroot/pgsql/src/backend/utils/misc/guc.c,v
retrieving revision 1.255
diff -u -r1.255 guc.c
--- src/backend/utils/misc/guc.c 13 Mar 2005 09:36:31 -0000 1.255
+++ src/backend/utils/misc/guc.c 15 Mar 2005 16:12:05 -0000
@@ -4176,6 +4176,8 @@
const char *short_desc,
const char *long_desc,
int *valueAddr,
+ int minValue,
+ int maxValue,
GucContext context,
GucIntAssignHook assign_hook,
GucShowHook show_hook)
@@ -4188,6 +4190,8 @@

var->variable = valueAddr;
var->reset_val = *valueAddr;
+ var->min = minValue;
+ var->max = maxValue;
var->assign_hook = assign_hook;
var->show_hook = show_hook;
define_custom_variable(&var->gen);
@@ -4199,6 +4203,8 @@
const char *short_desc,
const char *long_desc,
double *valueAddr,
+ double minValue,
+ double maxValue,
GucContext context,
GucRealAssignHook assign_hook,
GucShowHook show_hook)
@@ -4211,6 +4217,8 @@

var->variable = valueAddr;
var->reset_val = *valueAddr;
+ var->min = minValue;
+ var->max = maxValue;
var->assign_hook = assign_hook;
var->show_hook = show_hook;
define_custom_variable(&var->gen);
Index: src/include/utils/guc.h
================================================== =================
RCS file: /projects/cvsroot/pgsql/src/include/utils/guc.h,v
retrieving revision 1.58
diff -u -r1.58 guc.h
--- src/include/utils/guc.h 1 Jan 2005 05:43:09 -0000 1.58
+++ src/include/utils/guc.h 15 Mar 2005 16:12:06 -0000
@@ -149,6 +149,8 @@
const char *short_desc,
const char *long_desc,
int *valueAddr,
+ int minValue,
+ int maxValue,
GucContext context,
GucIntAssignHook assign_hook,
GucShowHook show_hook);
@@ -158,6 +160,8 @@
const char *short_desc,
const char *long_desc,
double *valueAddr,
+ double minValue,
+ double maxValue,
GucContext context,
GucRealAssignHook assign_hook,
GucShowHook show_hook);


---------------------------(end of broadcast)---------------------------
TIP 9: the planner will ignore your desire to choose an index scan if your
joining column's datatypes do not match

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 04-18-2008, 12:11 AM
Tom Lane
 
Posts: n/a
Default Re: Fix that deals with unusable custom variables.

Thomas Hallgren <thhal@mailblocks.com> writes:
> This is a bit embarrassing but the patch I submitted that enables custom
> variable classes (8-10 months ago) was somewhat incomplete. The
> DefineCustomIntVariable and DefineCustomRealVariable functions doesn't
> have parameters that make it possible to set the min and max values of
> the variables. Consequently, custom variables of int and real type are
> completely useless. This patch adds the additional parameters minValue
> and maxValue to those functions.


> No one but me have used this so far (or someone would have noticed) so I
> think it would be safe to backport this for 8.0.2.


Applied to HEAD and 8.0.

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 04:34 PM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com