diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2001-12-04 02:07:11 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2001-12-04 02:07:11 +0000 |
commit | 05321754965b0f5a9562adf7acef89231130c69e (patch) | |
tree | cb72ae0e223c61ae227f80509482a248ba5aea93 /doc/src | |
parent | 7321eed9e820d539742b965e853334a73211ab25 (diff) | |
download | postgresql-05321754965b0f5a9562adf7acef89231130c69e.tar.gz postgresql-05321754965b0f5a9562adf7acef89231130c69e.zip |
Fix trigger example for PG 7.2 change: count(*) now returns int8.
Diffstat (limited to 'doc/src')
-rw-r--r-- | doc/src/sgml/trigger.sgml | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/doc/src/sgml/trigger.sgml b/doc/src/sgml/trigger.sgml index 540ef0f71b3..10a49244b4c 100644 --- a/doc/src/sgml/trigger.sgml +++ b/doc/src/sgml/trigger.sgml @@ -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> @@ -451,7 +455,7 @@ PG_FUNCTION_INFO_V1(trigf); Datum trigf(PG_FUNCTION_ARGS) { - TriggerData *trigdata = (TriggerData *) fcinfo->context; + TriggerData *trigdata = (TriggerData *) fcinfo->context; TupleDesc tupdesc; HeapTuple rettuple; char *when; @@ -490,8 +494,12 @@ 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; } |