Chris Browne cbbrowne at lists.slony.info
Wed Apr 23 13:35:45 PDT 2008
Update of /home/cvsd/slony1/slony1-engine/src/backend
In directory main.slony.info:/tmp/cvs-serv2424/backend

Modified Files:
	slony1_funcs.c slony1_funcs.sql 
Log Message:
Ran pgindent against C code


Index: slony1_funcs.c
===================================================================
RCS file: /home/cvsd/slony1/slony1-engine/src/backend/slony1_funcs.c,v
retrieving revision 1.65
retrieving revision 1.66
diff -C2 -d -r1.65 -r1.66
*** slony1_funcs.c	16 Apr 2008 21:23:54 -0000	1.65
--- slony1_funcs.c	23 Apr 2008 20:35:43 -0000	1.66
***************
*** 4,8 ****
   *	  The C functions and triggers portion of Slony-I.
   *
!  *	Copyright (c) 2003-2007, PostgreSQL Global Development Group 
   *	Author: Jan Wieck, Afilias USA INC.
   *
--- 4,8 ----
   *	  The C functions and triggers portion of Slony-I.
   *
!  *	Copyright (c) 2003-2007, PostgreSQL Global Development Group
   *	Author: Jan Wieck, Afilias USA INC.
   *
***************
*** 111,118 ****
  
  	struct slony_I_cluster_status *next;
! }	Slony_I_ClusterStatus;
  
  /*@null@*/
! static Slony_I_ClusterStatus *clusterStatusList = NULL;  
  static Slony_I_ClusterStatus *
  getClusterStatus(Name cluster_name,
--- 111,118 ----
  
  	struct slony_I_cluster_status *next;
! } Slony_I_ClusterStatus;
  
  /*@null@*/
! static Slony_I_ClusterStatus *clusterStatusList = NULL;
  static Slony_I_ClusterStatus *
  getClusterStatus(Name cluster_name,
***************
*** 176,180 ****
  		if (i >= PG_NARGS() || PG_ARGISNULL(i))
  		{
! 			argv[i - 1] = (Datum)0;
  			nulls[i - 1] = 'n';
  		}
--- 176,180 ----
  		if (i >= PG_NARGS() || PG_ARGISNULL(i))
  		{
! 			argv[i - 1] = (Datum) 0;
  			nulls[i - 1] = 'n';
  		}
***************
*** 221,224 ****
--- 221,225 ----
  	PG_RETURN_INT64(retval);
  }
+ 
  /*@+mustfreefresh@*/
  
***************
*** 265,269 ****
  	retval = palloc(VARHDRSZ + len);
  
!         SET_VARSIZE(retval,VARHDRSZ + len);
  	memcpy(VARDATA(retval), SLONY_I_VERSION_STRING, len);
  
--- 266,270 ----
  	retval = palloc(VARHDRSZ + len);
  
! 	SET_VARSIZE(retval, VARHDRSZ + len);
  	memcpy(VARDATA(retval), SLONY_I_VERSION_STRING, len);
  
***************
*** 335,344 ****
  	if (!TransactionIdEquals(cs->currentXid, newXid))
  	{
! 		int32	log_status;
  
  		/*
  		 * Determine the currently active log table
  		 */
! 		if(SPI_execp(cs->plan_get_logstatus, NULL, NULL, 0) < 0)
  			elog(ERROR, "Slony-I: cannot determine log status");
  		if (SPI_processed != 1)
--- 336,345 ----
  	if (!TransactionIdEquals(cs->currentXid, newXid))
  	{
! 		int32		log_status;
  
  		/*
  		 * Determine the currently active log table
  		 */
! 		if (SPI_execp(cs->plan_get_logstatus, NULL, NULL, 0) < 0)
  			elog(ERROR, "Slony-I: cannot determine log status");
  		if (SPI_processed != 1)
***************
*** 346,364 ****
  
  		log_status = DatumGetInt32(SPI_getbinval(SPI_tuptable->vals[0],
! 									SPI_tuptable->tupdesc, 1, NULL));
  		SPI_freetuptable(SPI_tuptable);
  
! 		switch(log_status)
  		{
  			case 0:
! 			case 2:		cs->plan_active_log = cs->plan_insert_log_1;
! 						break;
! 			
  			case 1:
! 			case 3:		cs->plan_active_log = cs->plan_insert_log_2;
! 						break;
  
! 			default:	elog(ERROR, "Slony-I: illegal log status %d", log_status);
! 						break;
  		}
  
--- 347,368 ----
  
  		log_status = DatumGetInt32(SPI_getbinval(SPI_tuptable->vals[0],
! 											SPI_tuptable->tupdesc, 1, NULL));
  		SPI_freetuptable(SPI_tuptable);
  
! 		switch (log_status)
  		{
  			case 0:
! 			case 2:
! 				cs->plan_active_log = cs->plan_insert_log_1;
! 				break;
! 
  			case 1:
! 			case 3:
! 				cs->plan_active_log = cs->plan_insert_log_2;
! 				break;
  
! 			default:
! 				elog(ERROR, "Slony-I: illegal log status %d", log_status);
! 				break;
  		}
  
***************
*** 375,384 ****
  		char	   *col_ident;
  		char	   *col_value;
! 		
  		int			len_ident;
  		int			len_value;
  		int			i;
  		int			need_comma = false;
! 		char			*OldDateStyle;
  		char	   *cp = VARDATA(cs->cmddata_buf);
  
--- 379,388 ----
  		char	   *col_ident;
  		char	   *col_value;
! 
  		int			len_ident;
  		int			len_value;
  		int			i;
  		int			need_comma = false;
! 		char	   *OldDateStyle;
  		char	   *cp = VARDATA(cs->cmddata_buf);
  
***************
*** 402,416 ****
  				continue;
  
! 			col_ident = (char *)slon_quote_identifier(SPI_fname(tupdesc, i + 1));
! 			cmddata_need = (cp - (char *)(cs->cmddata_buf)) + 16 +
  				(len_ident = strlen(col_ident));
  			if (cs->cmddata_size < cmddata_need)
  			{
! 				int			have = (cp - (char *)(cs->cmddata_buf));
  
  				while (cs->cmddata_size < cmddata_need)
  					cs->cmddata_size *= 2;
  				cs->cmddata_buf = realloc(cs->cmddata_buf, cs->cmddata_size);
! 				cp = (char *)(cs->cmddata_buf) + have;
  			}
  
--- 406,420 ----
  				continue;
  
! 			col_ident = (char *) slon_quote_identifier(SPI_fname(tupdesc, i + 1));
! 			cmddata_need = (cp - (char *) (cs->cmddata_buf)) + 16 +
  				(len_ident = strlen(col_ident));
  			if (cs->cmddata_size < cmddata_need)
  			{
! 				int			have = (cp - (char *) (cs->cmddata_buf));
  
  				while (cs->cmddata_size < cmddata_need)
  					cs->cmddata_size *= 2;
  				cs->cmddata_buf = realloc(cs->cmddata_buf, cs->cmddata_size);
! 				cp = (char *) (cs->cmddata_buf) + have;
  			}
  
***************
*** 442,447 ****
  		 */
  		need_comma = false;
! 		OldDateStyle=GetConfigOptionByName("DateStyle", NULL);
! 		if (!strstr(OldDateStyle,"ISO"))
  			set_config_option("DateStyle", "ISO", PGC_USERSET, PGC_S_SESSION, true, true);
  		for (i = 0; i < tg->tg_relation->rd_att->natts; i++)
--- 446,451 ----
  		 */
  		need_comma = false;
! 		OldDateStyle = GetConfigOptionByName("DateStyle", NULL);
! 		if (!strstr(OldDateStyle, "ISO"))
  			set_config_option("DateStyle", "ISO", PGC_USERSET, PGC_S_SESSION, true, true);
  		for (i = 0; i < tg->tg_relation->rd_att->natts; i++)
***************
*** 463,476 ****
  			}
  
! 			cmddata_need = (cp - (char *)(cs->cmddata_buf)) + 16 +
  				(len_value = strlen(col_value));
  			if (cs->cmddata_size < cmddata_need)
  			{
! 				int			have = (cp - (char *)(cs->cmddata_buf));
  
  				while (cs->cmddata_size < cmddata_need)
  					cs->cmddata_size *= 2;
  				cs->cmddata_buf = realloc(cs->cmddata_buf, cs->cmddata_size);
! 				cp = (char *)(cs->cmddata_buf) + have;
  			}
  
--- 467,480 ----
  			}
  
! 			cmddata_need = (cp - (char *) (cs->cmddata_buf)) + 16 +
  				(len_value = strlen(col_value));
  			if (cs->cmddata_size < cmddata_need)
  			{
! 				int			have = (cp - (char *) (cs->cmddata_buf));
  
  				while (cs->cmddata_size < cmddata_need)
  					cs->cmddata_size *= 2;
  				cs->cmddata_buf = realloc(cs->cmddata_buf, cs->cmddata_size);
! 				cp = (char *) (cs->cmddata_buf) + have;
  			}
  
***************
*** 484,488 ****
  		}
  
! 		if (!strstr(OldDateStyle,"ISO"))
  			set_config_option("DateStyle", OldDateStyle, PGC_USERSET, PGC_S_SESSION, true, true);
  
--- 488,492 ----
  		}
  
! 		if (!strstr(OldDateStyle, "ISO"))
  			set_config_option("DateStyle", OldDateStyle, PGC_USERSET, PGC_S_SESSION, true, true);
  
***************
*** 492,497 ****
  		*cp++ = ')';
  		*cp = '\0';
! 		SET_VARSIZE(cs->cmddata_buf, 
!                         VARHDRSZ + (cp - VARDATA(cs->cmddata_buf)));
  	}
  	else if (TRIGGER_FIRED_BY_UPDATE(tg->tg_event))
--- 496,501 ----
  		*cp++ = ')';
  		*cp = '\0';
! 		SET_VARSIZE(cs->cmddata_buf,
! 					VARHDRSZ + (cp - VARDATA(cs->cmddata_buf)));
  	}
  	else if (TRIGGER_FIRED_BY_UPDATE(tg->tg_event))
***************
*** 512,516 ****
  		int			need_comma = false;
  		int			need_and = false;
! 		char		*OldDateStyle;
  
  		char	   *cp = VARDATA(cs->cmddata_buf);
--- 516,520 ----
  		int			need_comma = false;
  		int			need_and = false;
! 		char	   *OldDateStyle;
  
  		char	   *cp = VARDATA(cs->cmddata_buf);
***************
*** 519,524 ****
  		 * UPDATE
  		 *
! 		 * cmdtype = 'U' cmddata = "col_ident"='value' [, ...] where "pk_ident" =
! 		 * 'value' [ and ...]
  		 */
  		cmdtype = cs->cmdtype_U;
--- 523,528 ----
  		 * UPDATE
  		 *
! 		 * cmdtype = 'U' cmddata = "col_ident"='value' [, ...] where
! 		 * "pk_ident" = 'value' [ and ...]
  		 */
  		cmdtype = cs->cmdtype_U;
***************
*** 603,629 ****
  				need_comma = true;
  
! 			col_ident = (char *)slon_quote_identifier(SPI_fname(tupdesc, i + 1));
  			if (new_isnull)
  				col_value = "NULL";
  			else
  			{
! 				OldDateStyle=GetConfigOptionByName("DateStyle", NULL);
! 				if (!strstr(OldDateStyle,"ISO"))
  					set_config_option("DateStyle", "ISO", PGC_USERSET, PGC_S_SESSION, true, true);
  				col_value = slon_quote_literal(SPI_getvalue(new_row, tupdesc, i + 1));
! 				if (!strstr(OldDateStyle,"ISO"))
  					set_config_option("DateStyle", OldDateStyle, PGC_USERSET, PGC_S_SESSION, true, true);
  			}
! 			cmddata_need = (cp - (char *)(cs->cmddata_buf)) + 16 +
  				(len_ident = strlen(col_ident)) +
  				(len_value = strlen(col_value));
  			if (cs->cmddata_size < cmddata_need)
  			{
! 				int			have = (cp - (char *)(cs->cmddata_buf));
  
  				while (cs->cmddata_size < cmddata_need)
  					cs->cmddata_size *= 2;
  				cs->cmddata_buf = realloc(cs->cmddata_buf, cs->cmddata_size);
! 				cp = (char *)(cs->cmddata_buf) + have;
  			}
  
--- 607,633 ----
  				need_comma = true;
  
! 			col_ident = (char *) slon_quote_identifier(SPI_fname(tupdesc, i + 1));
  			if (new_isnull)
  				col_value = "NULL";
  			else
  			{
! 				OldDateStyle = GetConfigOptionByName("DateStyle", NULL);
! 				if (!strstr(OldDateStyle, "ISO"))
  					set_config_option("DateStyle", "ISO", PGC_USERSET, PGC_S_SESSION, true, true);
  				col_value = slon_quote_literal(SPI_getvalue(new_row, tupdesc, i + 1));
! 				if (!strstr(OldDateStyle, "ISO"))
  					set_config_option("DateStyle", OldDateStyle, PGC_USERSET, PGC_S_SESSION, true, true);
  			}
! 			cmddata_need = (cp - (char *) (cs->cmddata_buf)) + 16 +
  				(len_ident = strlen(col_ident)) +
  				(len_value = strlen(col_value));
  			if (cs->cmddata_size < cmddata_need)
  			{
! 				int			have = (cp - (char *) (cs->cmddata_buf));
  
  				while (cs->cmddata_size < cmddata_need)
  					cs->cmddata_size *= 2;
  				cs->cmddata_buf = realloc(cs->cmddata_buf, cs->cmddata_size);
! 				cp = (char *) (cs->cmddata_buf) + have;
  			}
  
***************
*** 653,670 ****
  					break;
  			}
! 			col_ident = (char *)slon_quote_identifier(SPI_fname(tupdesc, i + 1));
  			col_value = slon_quote_literal(SPI_getvalue(old_row, tupdesc, i + 1));
  
! 			cmddata_need = (cp - (char *)(cs->cmddata_buf)) + 16 +
  				(len_ident = strlen(col_ident)) +
  				(len_value = strlen(col_value));
  			if (cs->cmddata_size < cmddata_need)
  			{
! 				int			have = (cp - (char *)(cs->cmddata_buf));
  
  				while (cs->cmddata_size < cmddata_need)
  					cs->cmddata_size *= 2;
  				cs->cmddata_buf = realloc(cs->cmddata_buf, cs->cmddata_size);
! 				cp = (char *)(cs->cmddata_buf) + have;
  			}
  
--- 657,674 ----
  					break;
  			}
! 			col_ident = (char *) slon_quote_identifier(SPI_fname(tupdesc, i + 1));
  			col_value = slon_quote_literal(SPI_getvalue(old_row, tupdesc, i + 1));
  
! 			cmddata_need = (cp - (char *) (cs->cmddata_buf)) + 16 +
  				(len_ident = strlen(col_ident)) +
  				(len_value = strlen(col_value));
  			if (cs->cmddata_size < cmddata_need)
  			{
! 				int			have = (cp - (char *) (cs->cmddata_buf));
  
  				while (cs->cmddata_size < cmddata_need)
  					cs->cmddata_size *= 2;
  				cs->cmddata_buf = realloc(cs->cmddata_buf, cs->cmddata_size);
! 				cp = (char *) (cs->cmddata_buf) + have;
  			}
  
***************
*** 695,715 ****
  			if (attkind[attkind_idx] != 'k')
  				continue;
! 			col_ident = (char *)slon_quote_identifier(SPI_fname(tupdesc, i + 1));
  			col_value = slon_quote_literal(SPI_getvalue(old_row, tupdesc, i + 1));
  			if (col_value == NULL)
! 				elog(ERROR, "Slony-I: old key column %s.%s IS NULL on UPDATE", 
! 					NameStr(tg->tg_relation->rd_rel->relname), col_ident);
  
! 			cmddata_need = (cp - (char *)(cs->cmddata_buf)) + 16 +
  				(len_ident = strlen(col_ident)) +
  				(len_value = strlen(col_value));
  			if (cs->cmddata_size < cmddata_need)
  			{
! 				int			have = (cp - (char *)(cs->cmddata_buf));
  
  				while (cs->cmddata_size < cmddata_need)
  					cs->cmddata_size *= 2;
  				cs->cmddata_buf = realloc(cs->cmddata_buf, cs->cmddata_size);
! 				cp = (char *)(cs->cmddata_buf) + have;
  			}
  
--- 699,719 ----
  			if (attkind[attkind_idx] != 'k')
  				continue;
! 			col_ident = (char *) slon_quote_identifier(SPI_fname(tupdesc, i + 1));
  			col_value = slon_quote_literal(SPI_getvalue(old_row, tupdesc, i + 1));
  			if (col_value == NULL)
! 				elog(ERROR, "Slony-I: old key column %s.%s IS NULL on UPDATE",
! 					 NameStr(tg->tg_relation->rd_rel->relname), col_ident);
  
! 			cmddata_need = (cp - (char *) (cs->cmddata_buf)) + 16 +
  				(len_ident = strlen(col_ident)) +
  				(len_value = strlen(col_value));
  			if (cs->cmddata_size < cmddata_need)
  			{
! 				int			have = (cp - (char *) (cs->cmddata_buf));
  
  				while (cs->cmddata_size < cmddata_need)
  					cs->cmddata_size *= 2;
  				cs->cmddata_buf = realloc(cs->cmddata_buf, cs->cmddata_size);
! 				cp = (char *) (cs->cmddata_buf) + have;
  			}
  
***************
*** 733,737 ****
  		*cp = '\0';
  		SET_VARSIZE(cs->cmddata_buf,
! 			VARHDRSZ + (cp - VARDATA(cs->cmddata_buf)));
  	}
  	else if (TRIGGER_FIRED_BY_DELETE(tg->tg_event))
--- 737,741 ----
  		*cp = '\0';
  		SET_VARSIZE(cs->cmddata_buf,
! 					VARHDRSZ + (cp - VARDATA(cs->cmddata_buf)));
  	}
  	else if (TRIGGER_FIRED_BY_DELETE(tg->tg_event))
***************
*** 762,782 ****
  			if (attkind[attkind_idx] != 'k')
  				continue;
! 			col_ident = (char *)slon_quote_identifier(SPI_fname(tupdesc, i + 1));
  			col_value = slon_quote_literal(SPI_getvalue(old_row, tupdesc, i + 1));
  			if (col_value == NULL)
! 				elog(ERROR, "Slony-I: old key column %s.%s IS NULL on DELETE", 
! 					NameStr(tg->tg_relation->rd_rel->relname), col_ident);
  
! 			cmddata_need = (cp - (char *)(cs->cmddata_buf)) + 16 +
  				(len_ident = strlen(col_ident)) +
  				(len_value = strlen(col_value));
  			if (cs->cmddata_size < cmddata_need)
  			{
! 				int			have = (cp - (char *)(cs->cmddata_buf));
  
  				while (cs->cmddata_size < cmddata_need)
  					cs->cmddata_size *= 2;
  				cs->cmddata_buf = realloc(cs->cmddata_buf, cs->cmddata_size);
! 				cp = (char *)(cs->cmddata_buf) + have;
  			}
  
--- 766,786 ----
  			if (attkind[attkind_idx] != 'k')
  				continue;
! 			col_ident = (char *) slon_quote_identifier(SPI_fname(tupdesc, i + 1));
  			col_value = slon_quote_literal(SPI_getvalue(old_row, tupdesc, i + 1));
  			if (col_value == NULL)
! 				elog(ERROR, "Slony-I: old key column %s.%s IS NULL on DELETE",
! 					 NameStr(tg->tg_relation->rd_rel->relname), col_ident);
  
! 			cmddata_need = (cp - (char *) (cs->cmddata_buf)) + 16 +
  				(len_ident = strlen(col_ident)) +
  				(len_value = strlen(col_value));
  			if (cs->cmddata_size < cmddata_need)
  			{
! 				int			have = (cp - (char *) (cs->cmddata_buf));
  
  				while (cs->cmddata_size < cmddata_need)
  					cs->cmddata_size *= 2;
  				cs->cmddata_buf = realloc(cs->cmddata_buf, cs->cmddata_size);
! 				cp = (char *) (cs->cmddata_buf) + have;
  			}
  
***************
*** 800,804 ****
  		*cp = '\0';
  		SET_VARSIZE(cs->cmddata_buf,
! 			VARHDRSZ + (cp - VARDATA(cs->cmddata_buf)));
  	}
  	else
--- 804,808 ----
  		*cp = '\0';
  		SET_VARSIZE(cs->cmddata_buf,
! 					VARHDRSZ + (cp - VARDATA(cs->cmddata_buf)));
  	}
  	else
***************
*** 847,860 ****
  
  	/*
! 	 * If the replication role is:
! 	 *  ORIGIN - default role --> FAIL
! 	 *  REPLICA - this trigger will not fire in --> N/A
!      *  LOCAL - role when running "local updates" --> PERMIT UPDATE
!      */
  	if (SessionReplicationRole == SESSION_REPLICATION_ROLE_ORIGIN)
! 			elog(ERROR,
! 				 "Slony-I: Table %s is replicated and cannot be "
! 				 "modified on a subscriber node - role=%d",
! 				 NameStr(tg->tg_relation->rd_rel->relname), SessionReplicationRole);
  
  	SPI_finish();
--- 851,863 ----
  
  	/*
! 	 * If the replication role is: ORIGIN - default role --> FAIL REPLICA -
! 	 * this trigger will not fire in --> N/A LOCAL - role when running "local
! 	 * updates" --> PERMIT UPDATE
! 	 */
  	if (SessionReplicationRole == SESSION_REPLICATION_ROLE_ORIGIN)
! 		elog(ERROR,
! 			 "Slony-I: Table %s is replicated and cannot be "
! 			 "modified on a subscriber node - role=%d",
! 		  NameStr(tg->tg_relation->rd_rel->relname), SessionReplicationRole);
  
  	SPI_finish();
***************
*** 893,897 ****
  		 NameStr(tg->tg_relation->rd_rel->relname));
  
! 	return (Datum)0;
  }
  
--- 896,900 ----
  		 NameStr(tg->tg_relation->rd_rel->relname));
  
! 	return (Datum) 0;
  }
  
***************
*** 933,939 ****
  
  
! typedef struct {
! 	int32	seqid;
! 	int64	seqval;
  } SeqTrack_elem;
  
--- 936,943 ----
  
  
! typedef struct
! {
! 	int32		seqid;
! 	int64		seqval;
  } SeqTrack_elem;
  
***************
*** 941,948 ****
  seqtrack_cmp(void *seq1, void *seq2)
  {
! 	return (((SeqTrack_elem *)seq1)->seqid - ((SeqTrack_elem *)seq2)->seqid);
  }
  
! static void 
  seqtrack_free(void *seq)
  {
--- 945,952 ----
  seqtrack_cmp(void *seq1, void *seq2)
  {
! 	return (((SeqTrack_elem *) seq1)->seqid - ((SeqTrack_elem *) seq2)->seqid);
  }
  
! static void
  seqtrack_free(void *seq)
  {
***************
*** 954,961 ****
  {
  	static AVLtree seqmem = AVL_INITIALIZER(seqtrack_cmp, seqtrack_free);
! 	AVLnode		   *node;
! 	SeqTrack_elem  *elem;
! 	int32			seqid;
! 	int64			seqval;
  
  	seqid = PG_GETARG_INT32(0);
--- 958,965 ----
  {
  	static AVLtree seqmem = AVL_INITIALIZER(seqtrack_cmp, seqtrack_free);
! 	AVLnode    *node;
! 	SeqTrack_elem *elem;
! 	int32		seqid;
! 	int64		seqval;
  
  	seqid = PG_GETARG_INT32(0);
***************
*** 974,978 ****
  		 * remember the current lastval and return it to the caller.
  		 */
! 		elem = (SeqTrack_elem *)malloc(sizeof(SeqTrack_elem));
  		elem->seqid = seqid;
  		elem->seqval = seqval;
--- 978,982 ----
  		 * remember the current lastval and return it to the caller.
  		 */
! 		elem = (SeqTrack_elem *) malloc(sizeof(SeqTrack_elem));
  		elem->seqid = seqid;
  		elem->seqval = seqval;
***************
*** 983,988 ****
  
  	/*
! 	 * This is a sequence seen before. If the value has changed
! 	 * remember and return it. If it did not, return NULL.
  	 */
  	elem = AVL_DATA(node);
--- 987,992 ----
  
  	/*
! 	 * This is a sequence seen before. If the value has changed remember and
! 	 * return it. If it did not, return NULL.
  	 */
  	elem = AVL_DATA(node);
***************
*** 1017,1021 ****
  	while (len > 0)
  	{
! 		if ((wl = pg_mblen((unsigned char *)cp1)) != 1)
  		{
  			len -= wl;
--- 1021,1025 ----
  	while (len > 0)
  	{
! 		if ((wl = pg_mblen((unsigned char *) cp1)) != 1)
  		{
  			len -= wl;
***************
*** 1095,1100 ****
  		 * identifier is safe or not... so be safe not sorry.
  		 *
! 		 * Note: ScanKeywordLookup() does case-insensitive comparison, but that's
! 		 * fine, since we already know we have all-lower-case.
  		 */
  		if (ScanKeywordLookup(ident) != NULL)
--- 1099,1104 ----
  		 * identifier is safe or not... so be safe not sorry.
  		 *
! 		 * Note: ScanKeywordLookup() does case-insensitive comparison, but
! 		 * that's fine, since we already know we have all-lower-case.
  		 */
  		if (ScanKeywordLookup(ident) != NULL)
***************
*** 1105,1109 ****
  		return ident;			/* no change needed */
  
! 	result = (char *)palloc(strlen(ident) + nquotes + 2 + 1);
  
  	optr = result;
--- 1109,1113 ----
  		return ident;			/* no change needed */
  
! 	result = (char *) palloc(strlen(ident) + nquotes + 2 + 1);
  
  	optr = result;
***************
*** 1142,1146 ****
  	/* We have to convert to a C string to use quote_identifier */
  	len = VARSIZE(t) - VARHDRSZ;
! 	str = (char *)palloc(len + 1);
  	memcpy(str, VARDATA(t), len);
  	str[len] = '\0';
--- 1146,1150 ----
  	/* We have to convert to a C string to use quote_identifier */
  	len = VARSIZE(t) - VARHDRSZ;
! 	str = (char *) palloc(len + 1);
  	memcpy(str, VARDATA(t), len);
  	str[len] = '\0';
***************
*** 1265,1269 ****
  					makeString("txid_snapshot"));
  
! 		txid_snapshot_typid = typenameTypeId(NULL,txid_snapshot_typname, NULL);
  
  		/*
--- 1269,1273 ----
  					makeString("txid_snapshot"));
  
! 		txid_snapshot_typid = typenameTypeId(NULL, txid_snapshot_typname, NULL);
  
  		/*
***************
*** 1305,1319 ****
  		 */
  		sprintf(query,
! 			"insert into %s.sl_seqlog "
! 			"(seql_seqid, seql_origin, seql_ev_seqno, seql_last_value) "
! 			"select * from ("
! 			"select seq_id, %d, currval('%s.sl_event_seq'), seq_last_value "
! 			"from %s.sl_seqlastvalue "
! 			"where seq_origin = '%d') as FOO "
! 			"where NOT %s.seqtrack(seq_id, seq_last_value) IS NULL; ",
! 			cs->clusterident,
! 			cs->localNodeId, cs->clusterident,
! 			cs->clusterident, cs->localNodeId,
! 			cs->clusterident);
  
  		cs->plan_record_sequences = SPI_saveplan(SPI_prepare(query, 0, NULL));
--- 1309,1323 ----
  		 */
  		sprintf(query,
! 				"insert into %s.sl_seqlog "
! 				"(seql_seqid, seql_origin, seql_ev_seqno, seql_last_value) "
! 				"select * from ("
! 			 "select seq_id, %d, currval('%s.sl_event_seq'), seq_last_value "
! 				"from %s.sl_seqlastvalue "
! 				"where seq_origin = '%d') as FOO "
! 				"where NOT %s.seqtrack(seq_id, seq_last_value) IS NULL; ",
! 				cs->clusterident,
! 				cs->localNodeId, cs->clusterident,
! 				cs->clusterident, cs->localNodeId,
! 				cs->clusterident);
  
  		cs->plan_record_sequences = SPI_saveplan(SPI_prepare(query, 0, NULL));
***************
*** 1361,1365 ****
  			elog(ERROR, "Slony-I: SPI_prepare() failed");
  
! 		/*@-nullderef@*/
  		/*
  		 * Also create the 3 rather static text values for the log_cmdtype
--- 1365,1370 ----
  			elog(ERROR, "Slony-I: SPI_prepare() failed");
  
! 		/* @-nullderef@ */
! 
  		/*
  		 * Also create the 3 rather static text values for the log_cmdtype
***************
*** 1390,1394 ****
  
  	return cs;
! 	/*@+nullderef@*/
  }
  
--- 1395,1399 ----
  
  	return cs;
! 	/* @+nullderef@ */
  }
  

Index: slony1_funcs.sql
===================================================================
RCS file: /home/cvsd/slony1/slony1-engine/src/backend/slony1_funcs.sql,v
retrieving revision 1.136
retrieving revision 1.137
diff -C2 -d -r1.136 -r1.137
*** slony1_funcs.sql	16 Apr 2008 21:23:54 -0000	1.136
--- slony1_funcs.sql	23 Apr 2008 20:35:43 -0000	1.137
***************
*** 3602,3608 ****
  		-- 1.  Running on origin, where denyaccess() triggers are already shut off
  		-- 2.  Running on replica, where we need the LOCAL role to suppress denyaccess() triggers
! 		if (v_set_origin <> @NAMESPACE at .getLocalNodeId(''_ at CLUSTERNAME@'') then
! 			set session_replication_role to local;
! 		end if
  	end if;
  	return 1;
--- 3602,3608 ----
  		-- 1.  Running on origin, where denyaccess() triggers are already shut off
  		-- 2.  Running on replica, where we need the LOCAL role to suppress denyaccess() triggers
! 		if (v_set_origin <> @NAMESPACE at .getLocalNodeId(''_ at CLUSTERNAME@'')) then
! 			execute ''set session_replication_role to local;'';
! 		end if;
  	end if;
  	return 1;



More information about the Slony1-commit mailing list