Chris Browne cbbrowne at lists.slony.info
Wed May 2 14:37:09 PDT 2007
Update of /home/cvsd/slony1/slony1-engine/src/backend
In directory main.slony.info:/tmp/cvs-serv8813/src/backend

Modified Files:
      Tag: REL_1_2_STABLE
	slony1_funcs.c 
Log Message:
Changes to support PostgreSQL 8.3 as VARATT_SIZEP has been deprecated.


Index: slony1_funcs.c
===================================================================
RCS file: /home/cvsd/slony1/slony1-engine/src/backend/slony1_funcs.c,v
retrieving revision 1.53.2.1
retrieving revision 1.53.2.2
diff -C2 -d -r1.53.2.1 -r1.53.2.2
*** slony1_funcs.c	18 Apr 2007 19:28:27 -0000	1.53.2.1
--- slony1_funcs.c	2 May 2007 21:37:07 -0000	1.53.2.2
***************
*** 42,47 ****
  
  /* -- Change from PostgreSQL Ver 8.3 -- */
! #ifndef VARATT_SIZEP
! #define VARATT_SIZEP VARATT_SIZEP_DEPRECATED
  #endif
  
--- 42,47 ----
  
  /* -- Change from PostgreSQL Ver 8.3 -- */
! #if !((PG_VERSION_MAJOR > 8) || ((PG_VERSION_MAJOR == 8) && (PG_VERSION_MINOR >= 3)))
! #define SET_VARSIZE(datum, size) (VARATT_SIZEP(datum)=(size))
  #endif
  
***************
*** 296,300 ****
  	len = strlen(SLONY_I_VERSION_STRING);
  	retval = palloc(VARHDRSZ + len);
! 	VARATT_SIZEP(retval) = VARHDRSZ + len;
  	memcpy(VARDATA(retval), SLONY_I_VERSION_STRING, len);
  
--- 296,301 ----
  	len = strlen(SLONY_I_VERSION_STRING);
  	retval = palloc(VARHDRSZ + len);
! 
!         SET_VARSIZE(retval,VARHDRSZ + len);
  	memcpy(VARDATA(retval), SLONY_I_VERSION_STRING, len);
  
***************
*** 369,373 ****
  			cs->session_role = SLON_ROLE_NORMAL;
  			retval = palloc(VARHDRSZ + 6);
! 			VARATT_SIZEP(retval) = VARHDRSZ + 6;
  			memcpy(VARDATA(retval), "normal", 6);
  			break;
--- 370,374 ----
  			cs->session_role = SLON_ROLE_NORMAL;
  			retval = palloc(VARHDRSZ + 6);
! 			SET_VARSIZE(retval, VARHDRSZ + 6);
  			memcpy(VARDATA(retval), "normal", 6);
  			break;
***************
*** 375,379 ****
  		case SLON_ROLE_NORMAL:
  			retval = palloc(VARHDRSZ + 6);
! 			VARATT_SIZEP(retval) = VARHDRSZ + 6;
  			memcpy(VARDATA(retval), "normal", 6);
  			break;
--- 376,380 ----
  		case SLON_ROLE_NORMAL:
  			retval = palloc(VARHDRSZ + 6);
! 			SET_VARSIZE(retval, VARHDRSZ + 6);
  			memcpy(VARDATA(retval), "normal", 6);
  			break;
***************
*** 381,385 ****
  		case SLON_ROLE_SLON:
  			retval = palloc(VARHDRSZ + 4);
! 			VARATT_SIZEP(retval) = VARHDRSZ + 4;
  			memcpy(VARDATA(retval), "slon", 4);
  			break;
--- 382,386 ----
  		case SLON_ROLE_SLON:
  			retval = palloc(VARHDRSZ + 4);
! 			SET_VARSIZE(retval, VARHDRSZ + 4);
  			memcpy(VARDATA(retval), "slon", 4);
  			break;
***************
*** 476,480 ****
  		if (SPI_processed != 1)
  			elog(ERROR, "Slony-I: cannot determine log status");
! 		
  		log_status = DatumGetInt32(SPI_getbinval(SPI_tuptable->vals[0],
  									SPI_tuptable->tupdesc, 1, NULL));
--- 477,481 ----
  		if (SPI_processed != 1)
  			elog(ERROR, "Slony-I: cannot determine log status");
! 
  		log_status = DatumGetInt32(SPI_getbinval(SPI_tuptable->vals[0],
  									SPI_tuptable->tupdesc, 1, NULL));
***************
*** 622,627 ****
  		*cp++ = ')';
  		*cp = '\0';
! 		VARATT_SIZEP(cs->cmddata_buf) =
! 			VARHDRSZ + (cp - VARDATA(cs->cmddata_buf));
  	}
  	else if (TRIGGER_FIRED_BY_UPDATE(tg->tg_event))
--- 623,628 ----
  		*cp++ = ')';
  		*cp = '\0';
! 		SET_VARSIZE(cs->cmddata_buf, 
!                         VARHDRSZ + (cp - VARDATA(cs->cmddata_buf)));
  	}
  	else if (TRIGGER_FIRED_BY_UPDATE(tg->tg_event))
***************
*** 860,865 ****
  		}
  		*cp = '\0';
! 		VARATT_SIZEP(cs->cmddata_buf) =
! 			VARHDRSZ + (cp - VARDATA(cs->cmddata_buf));
  	}
  	else if (TRIGGER_FIRED_BY_DELETE(tg->tg_event))
--- 861,866 ----
  		}
  		*cp = '\0';
! 		SET_VARSIZE(cs->cmddata_buf,
! 			VARHDRSZ + (cp - VARDATA(cs->cmddata_buf)));
  	}
  	else if (TRIGGER_FIRED_BY_DELETE(tg->tg_event))
***************
*** 927,932 ****
  		}
  		*cp = '\0';
! 		VARATT_SIZEP(cs->cmddata_buf) =
! 			VARHDRSZ + (cp - VARDATA(cs->cmddata_buf));
  	}
  	else
--- 928,933 ----
  		}
  		*cp = '\0';
! 		SET_VARSIZE(cs->cmddata_buf,
! 			VARHDRSZ + (cp - VARDATA(cs->cmddata_buf)));
  	}
  	else
***************
*** 1236,1240 ****
  	len = strlen(qstr);
  	result = (text *) palloc(len + VARHDRSZ);
! 	VARATT_SIZEP(result) = len + VARHDRSZ;
  	memcpy(VARDATA(result), qstr, len);
  
--- 1237,1241 ----
  	len = strlen(qstr);
  	result = (text *) palloc(len + VARHDRSZ);
! 	SET_VARSIZE(result, len + VARHDRSZ);
  	memcpy(VARDATA(result), qstr, len);
  
***************
*** 1478,1488 ****
  		 */
  		cs->cmdtype_I = malloc(VARHDRSZ + 1);
! 		VARATT_SIZEP(cs->cmdtype_I) = VARHDRSZ + 1;
  		*VARDATA(cs->cmdtype_I) = 'I';
  		cs->cmdtype_U = malloc(VARHDRSZ + 1);
! 		VARATT_SIZEP(cs->cmdtype_U) = VARHDRSZ + 1;
  		*VARDATA(cs->cmdtype_U) = 'U';
  		cs->cmdtype_D = malloc(VARHDRSZ + 1);
! 		VARATT_SIZEP(cs->cmdtype_D) = VARHDRSZ + 1;
  		*VARDATA(cs->cmdtype_D) = 'D';
  
--- 1479,1489 ----
  		 */
  		cs->cmdtype_I = malloc(VARHDRSZ + 1);
! 		SET_VARSIZE(cs->cmdtype_I, VARHDRSZ + 1);
  		*VARDATA(cs->cmdtype_I) = 'I';
  		cs->cmdtype_U = malloc(VARHDRSZ + 1);
! 		SET_VARSIZE(cs->cmdtype_U, VARHDRSZ + 1);
  		*VARDATA(cs->cmdtype_U) = 'U';
  		cs->cmdtype_D = malloc(VARHDRSZ + 1);
! 		SET_VARSIZE(cs->cmdtype_D, VARHDRSZ + 1);
  		*VARDATA(cs->cmdtype_D) = 'D';
  



More information about the Slony1-commit mailing list