mirror of
				https://github.com/postgres/postgres.git
				synced 2025-10-31 00:03:57 -04:00 
			
		
		
		
	Fix trigger example for PG 7.2 change: count(*) now returns int8.
This commit is contained in:
		
							parent
							
								
									7321eed9e8
								
							
						
					
					
						commit
						0532175496
					
				| @ -1,3 +1,7 @@ | ||||
| <!-- | ||||
| $Header: /cvsroot/pgsql/doc/src/sgml/trigger.sgml,v 1.19 2001/12/04 02:07:11 tgl Exp $ | ||||
| --> | ||||
| 
 | ||||
|  <chapter id="triggers"> | ||||
|   <title>Triggers</title> | ||||
| 
 | ||||
| @ -491,7 +495,11 @@ trigf(PG_FUNCTION_ARGS) | ||||
| 	if (ret < 0) | ||||
| 		elog(NOTICE, "trigf (fired %s): SPI_exec returned %d", when, ret); | ||||
| 
 | ||||
| 	i = SPI_getbinval(SPI_tuptable->vals[0], SPI_tuptable->tupdesc, 1, &isnull); | ||||
| 	/* count(*) returns int8 as of PG 7.2, so be careful to convert */ | ||||
| 	i = (int) DatumGetInt64(SPI_getbinval(SPI_tuptable->vals[0], | ||||
| 					      SPI_tuptable->tupdesc, | ||||
| 					      1, | ||||
| 					      &isnull)); | ||||
| 	 | ||||
| 	elog (NOTICE, "trigf (fired %s): there are %d tuples in ttest", when, i); | ||||
| 	 | ||||
| @ -499,7 +507,7 @@ trigf(PG_FUNCTION_ARGS) | ||||
| 	 | ||||
| 	if (checknull) | ||||
| 	{ | ||||
| 		i = SPI_getbinval(rettuple, tupdesc, 1, &isnull); | ||||
| 		(void) SPI_getbinval(rettuple, tupdesc, 1, &isnull); | ||||
| 		if (isnull) | ||||
| 			rettuple = NULL; | ||||
| 	} | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user