? tablefunc.8.2.diff
Index: tablefunc.c
===================================================================
RCS file: /cvsroot/pgsql/contrib/tablefunc/tablefunc.c,v
retrieving revision 1.45
diff -c -r1.45 tablefunc.c
*** tablefunc.c	4 Oct 2006 00:29:46 -0000	1.45
--- tablefunc.c	25 Oct 2007 22:24:40 -0000
***************
*** 535,542 ****
  				 * check to see if the rowid is the same as that of the last
  				 * tuple sent -- if so, skip this tuple entirely
  				 */
! 				if (i == 0)
  					values[0] = pstrdup(rowid);
  
  				if ((rowid != NULL) && (strcmp(rowid, values[0]) == 0))
  				{
--- 535,544 ----
  				 * check to see if the rowid is the same as that of the last
  				 * tuple sent -- if so, skip this tuple entirely
  				 */
! 				if (rowid && i == 0)
  					values[0] = pstrdup(rowid);
+ 				else if (i == 0)
+ 					break;
  
  				if ((rowid != NULL) && (strcmp(rowid, values[0]) == 0))
  				{
Index: data/ct.data
===================================================================
RCS file: /cvsroot/pgsql/contrib/tablefunc/data/ct.data,v
retrieving revision 1.1
diff -c -r1.1 ct.data
*** data/ct.data	12 Sep 2002 00:14:40 -0000	1.1
--- data/ct.data	25 Oct 2007 22:24:40 -0000
***************
*** 12,14 ****
--- 12,18 ----
  12	group2	test4	att1	val4
  13	group2	test4	att2	val5
  14	group2	test4	att3	val6
+ 15	group1	\N	att1	val9
+ 16	group1	\N	att2	val10
+ 17	group1	\N	att3	val11
+ 18	group1	\N	att4	val12
Index: expected/tablefunc.out
===================================================================
RCS file: /cvsroot/pgsql/contrib/tablefunc/expected/tablefunc.out,v
retrieving revision 1.13
diff -c -r1.13 tablefunc.out
*** expected/tablefunc.out	27 Feb 2006 16:09:49 -0000	1.13
--- expected/tablefunc.out	25 Oct 2007 22:24:40 -0000
***************
*** 150,155 ****
--- 150,160 ----
  insert into cth values(DEFAULT,'test2','02 March 2003','test_result','FAIL');
  insert into cth values(DEFAULT,'test2','02 March 2003','test_startdate','01 March 2003');
  insert into cth values(DEFAULT,'test2','02 March 2003','volts','3.1234');
+ -- next group tests for NULL rowids
+ insert into cth values(DEFAULT,NULL,'25 October 2007','temperature','57');
+ insert into cth values(DEFAULT,NULL,'25 October 2007','test_result','PASS');
+ insert into cth values(DEFAULT,NULL,'25 October 2007','test_startdate','24 October 2007');
+ insert into cth values(DEFAULT,NULL,'25 October 2007','volts','1.41234');
  -- return attributes as plain text
  SELECT * FROM crosstab(
    'SELECT rowid, rowdt, attribute, val FROM cth ORDER BY 1',
Index: sql/tablefunc.sql
===================================================================
RCS file: /cvsroot/pgsql/contrib/tablefunc/sql/tablefunc.sql,v
retrieving revision 1.12
diff -c -r1.12 tablefunc.sql
*** sql/tablefunc.sql	27 Feb 2006 16:09:49 -0000	1.12
--- sql/tablefunc.sql	25 Oct 2007 22:24:40 -0000
***************
*** 61,66 ****
--- 61,71 ----
  insert into cth values(DEFAULT,'test2','02 March 2003','test_result','FAIL');
  insert into cth values(DEFAULT,'test2','02 March 2003','test_startdate','01 March 2003');
  insert into cth values(DEFAULT,'test2','02 March 2003','volts','3.1234');
+ -- next group tests for NULL rowids
+ insert into cth values(DEFAULT,NULL,'25 October 2007','temperature','57');
+ insert into cth values(DEFAULT,NULL,'25 October 2007','test_result','PASS');
+ insert into cth values(DEFAULT,NULL,'25 October 2007','test_startdate','24 October 2007');
+ insert into cth values(DEFAULT,NULL,'25 October 2007','volts','1.41234');
  
  -- return attributes as plain text
  SELECT * FROM crosstab(
