Re: [PATCHES] [HACKERS] allowed user/db variables

2003-07-28 Thread Tom Lane
Aizaz Ahmed [EMAIL PROTECTED] writes:
 looks like there's some duplication between this array and the 
 static const char *const GucContext_names[] array in
 src/backend/utils/misc/help_config.c
 Is there some way we could have them both use the same array?

Good idea.  Please send a patch that exports the guc.c array for use in
the other file.  I'd lean towards the lower-cased spellings, though I'm
not strong about it.  (I'd also not use a dash in super-user.)

 Also, as a side note, I don't think Tom is a big fan of using comments
 to indicate what needs to be kept in sync with what, if I can take the
 liberty to quote him the last time a situation like this arose:

I still stand by that opinion.  We've seen a couple failures now with
respect to these arrays, but I think that comes from having people
independently patching the same code with too long delay between patch
submission and application.  The comment wouldn't have prevented the
error, because patch(1) can't read comments.

regards, tom lane

---(end of broadcast)---
TIP 8: explain analyze is your friend


Re: [PATCHES] [HACKERS] allowed user/db variables

2003-07-28 Thread Aizaz Ahmed
On Mon, 2003-07-28 at 10:57, Tom Lane wrote:
 Good idea.  Please send a patch that exports the guc.c array for use in
 the other file.  I'd lean towards the lower-cased spellings, though I'm
 not strong about it.  (I'd also not use a dash in super-user.)

I've attached the patch below. It modifies help_config.c to use the new
GucContextName array from guc.c

It also changes 'super-user' to 'superuser'

I was waiting for Joe's earlier patch to be applied, this should be safe
to apply now.

Thanks,
Aizaz
Index: backend/utils/misc/guc.c
===
RCS file: /projects/cvsroot/pgsql-server/src/backend/utils/misc/guc.c,v
retrieving revision 1.142
diff -c -p -r1.142 guc.c
*** backend/utils/misc/guc.c	28 Jul 2003 16:22:02 -	1.142
--- backend/utils/misc/guc.c	28 Jul 2003 18:01:38 -
*** static char *config_type_name[] = 
*** 169,181 
  /*
   * Used for pg_settings. Keep in sync with GucContext enum in guc.h
   */
! static char *GucContextName[] = 
  {
  	internal,
  	postmaster,
  	sighup,
  	backend,
! 	super-user,
  	userlimit,
  	user
  };
--- 169,181 
  /*
   * Used for pg_settings. Keep in sync with GucContext enum in guc.h
   */
! char *GucContextName[] = 
  {
  	internal,
  	postmaster,
  	sighup,
  	backend,
! 	superuser,
  	userlimit,
  	user
  };
Index: backend/utils/misc/help_config.c
===
RCS file: /projects/cvsroot/pgsql-server/src/backend/utils/misc/help_config.c,v
retrieving revision 1.2
diff -c -p -r1.2 help_config.c
*** backend/utils/misc/help_config.c	9 Jul 2003 17:57:47 -	1.2
--- backend/utils/misc/help_config.c	28 Jul 2003 18:01:38 -
*** static bool displayStruct(mixedStruct * 
*** 135,151 
  /*
   * This array contains the display names for each of the GucContexts available
   *
-  * Note: these strings are deliberately not localized.
   */
! static const char *const GucContext_names[] = {
! 	INTERNAL,
! 	POSTMASTER,
! 	SIGHUP,
! 	BACKEND,
! 	SUSET,
! 	USERLIMIT,
! 	USERSET
! };
  
  /*
   * Reads in the the command line options and sets the state of the program
--- 135,142 
  /*
   * This array contains the display names for each of the GucContexts available
   *
   */
! extern char * GucContextName[];
  
  /*
   * Reads in the the command line options and sets the state of the program
*** printGenericHead(struct config_generic s
*** 406,412 
  {
  	printf(gettext(GENERIC_FORMAT[outFormat]),
  		   structToPrint.name,
! 		   GucContext_names[structToPrint.context],
  		   gettext(config_group_names[structToPrint.group]));
  }
  
--- 397,403 
  {
  	printf(gettext(GENERIC_FORMAT[outFormat]),
  		   structToPrint.name,
! 		   GucContextName[structToPrint.context],
  		   gettext(config_group_names[structToPrint.group]));
  }
  

---(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


Re: [PATCHES] [HACKERS] allowed user/db variables

2003-07-28 Thread Tom Lane
Aizaz Ahmed [EMAIL PROTECTED] writes:
 Good idea.  Please send a patch that exports the guc.c array for use in
 the other file.  I'd lean towards the lower-cased spellings, though I'm
 not strong about it.  (I'd also not use a dash in super-user.)

 I've attached the patch below. It modifies help_config.c to use the new
 GucContextName array from guc.c

Applied, thanks.  I also did some other cleanup, including sticking the
enum constant names into the array declarations --- this is in service
of the notion that grepping for the constants should help you find
places you need to change when adding one.

regards, tom lane

---(end of broadcast)---
TIP 1: subscribe and unsubscribe commands go to [EMAIL PROTECTED]


Re: [PATCHES] ruleutils with pretty-print option

2003-07-28 Thread Andreas Pflug
Tom Lane wrote:

Andreas Pflug [EMAIL PROTECTED] writes:
 

+ 	int prettyFlags = !PG_ARGISNULL(1)  PG_GETARG_BOOL(1) ? PRETTYFLAG_PAREN|PRETTYFLAG_INDENT : 0;
   

Since the pg_proc entries are all marked strict, it's unnecessary for
you to write any ARGISNULL checks.
Yeah you're right, it's a remainder of the previous solution. it was 
late at night... But it won't do any harm either.

Regards,
Andreas
---(end of broadcast)---
TIP 6: Have you searched our list archives?
  http://archives.postgresql.org