OK, I have fixed the mistake I made that Tom pointed out.  The fix will
be in 7.0.1.  Tomorrow's snapshot will have it too.

Patch attached.

Thanks Tom.

> Jeff Davis <[EMAIL PROTECTED]> writes:
> > Regarding UNLISTEN: 'UNLISTEN <name>' does not remove
> > LISTEN entries for '<name>' in 'pg_listener' class,
> > nor does it prevent NOTIFYication.
> 
> It appears that this breakage is due to failure to maintain the index
> on pg_listener that was added in 7.0.  UNLISTEN <name> is the only
> operation that tries to use the index, and it's failing because there
> are paths in async.c that don't bother to create an index entry for
> inserted tuples.  Another way to show there is a problem is:
> 
> regression=# vacuum pg_listener;
> VACUUM
> regression=# listen test;
> LISTEN
> regression=# vacuum pg_listener;
> NOTICE:  Index pg_listener_relname_pid_index: NUMBER OF INDEX' TUPLES (0) IS NOT THE 
>SAME AS HEAP' (1).
>         Recreate the index.
> VACUUM
> 
> As far as I can tell, the index on pg_listener doesn't even begin to
> approach usefulness; speeding up UNLISTEN (which most apps never do at
> all, or at most once) is a poor return on the cost of updating the index
> (twice!) for every NOTIFY.  Therefore, rather than adding the missing
> code, what I'd really like to do is rip out the index and revert async.c
> to its indexless state.
> 
> However, I don't see any way to get rid of that index completely without
> an initdb, and it's too late for initdb in the 7.0 cycle.  If the index
> exists and async.c simply doesn't bother to update it, then we'll get
> notices like the above from VACUUM.  Can anyone see a way around that?
> 
>                       regards, tom lane
> 


-- 
  Bruce Momjian                        |  http://www.op.net/~candle
  [EMAIL PROTECTED]               |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026
? contrib/array/array_iterator.sql
? doc/src/sgml/app-psql.htm
? src/Makefile.custom
? src/crtags
? src/log
? src/config.log
? src/config.cache
? src/config.status
? src/GNUmakefile
? src/Makefile.global
? src/backend/fmgr.h
? src/backend/parse.h
? src/backend/postgres
? src/backend/global1.bki.source
? src/backend/local1_template1.bki.source
? src/backend/global1.description
? src/backend/local1_template1.description
? src/backend/catalog/genbki.sh
? src/backend/catalog/global1.bki.source
? src/backend/catalog/global1.description
? src/backend/catalog/local1_template1.bki.source
? src/backend/catalog/local1_template1.description
? src/backend/port/Makefile
? src/backend/utils/Gen_fmgrtab.sh
? src/backend/utils/fmgr.h
? src/backend/utils/fmgrtab.c
? src/bin/initdb/initdb
? src/bin/initlocation/initlocation
? src/bin/ipcclean/ipcclean
? src/bin/pg_ctl/pg_ctl
? src/bin/pg_dump/Makefile
? src/bin/pg_dump/pg_dump
? src/bin/pg_id/pg_id
? src/bin/pg_passwd/pg_passwd
? src/bin/pg_version/Makefile
? src/bin/pg_version/pg_version
? src/bin/pgaccess/pgaccess
? src/bin/pgtclsh/mkMakefile.tcldefs.sh
? src/bin/pgtclsh/mkMakefile.tkdefs.sh
? src/bin/pgtclsh/Makefile.tkdefs
? src/bin/pgtclsh/Makefile.tcldefs
? src/bin/pgtclsh/pgtclsh
? src/bin/pgtclsh/pgtksh
? src/bin/psql/ish
? src/bin/psql/Makefile
? src/bin/psql/psql
? src/bin/scripts/createlang
? src/include/version.h
? src/include/config.h
? src/interfaces/ecpg/lib/Makefile
? src/interfaces/ecpg/lib/libecpg.so.3.1.0
? src/interfaces/ecpg/preproc/Makefile
? src/interfaces/ecpg/preproc/ecpg
? src/interfaces/jdbc/DriverClass.class
? src/interfaces/jdbc/org/postgresql/DriverClass.java
? src/interfaces/libpgeasy/Makefile
? src/interfaces/libpgeasy/libpgeasy.so.2.1
? src/interfaces/libpgtcl/Makefile
? src/interfaces/libpgtcl/libpgtcl.so.2.1
? src/interfaces/libpq/Makefile
? src/interfaces/libpq/libpq.so.2.1
? src/interfaces/libpq++/Makefile
? src/interfaces/libpq++/libpq++.so.3.1
? src/interfaces/odbc/GNUmakefile
? src/interfaces/odbc/Makefile.global
? src/interfaces/perl5/blib
? src/interfaces/perl5/Makefile
? src/interfaces/perl5/pm_to_blib
? src/interfaces/perl5/Pg.c
? src/interfaces/perl5/Pg.bs
? src/interfaces/python/tutorial/pgtools.pyc
? src/interfaces/python/tutorial/basics.pyc
? src/pl/plpgsql/src/Makefile
? src/pl/plpgsql/src/mklang.sql
? src/pl/plpgsql/src/libplpgsql.so.1.0
? src/pl/tcl/mkMakefile.tcldefs.sh
? src/pl/tcl/Makefile.tcldefs
? src/test/regress/GNUmakefile
Index: src/backend/commands/async.c
===================================================================
RCS file: /usr/local/cvsroot/pgsql/src/backend/commands/async.c,v
retrieving revision 1.59
diff -c -r1.59 async.c
*** src/backend/commands/async.c        2000/04/12 17:14:57     1.59
--- src/backend/commands/async.c        2000/05/14 02:35:09
***************
*** 349,356 ****
--- 349,365 ----
        sRel = heap_beginscan(lRel, 0, SnapshotNow, 1, key);
  
        while (HeapTupleIsValid(lTuple = heap_getnext(sRel, 0)))
+       {
                heap_delete(lRel, &lTuple->t_self, NULL);
+               if (RelationGetForm(lRel)->relhasindex)
+               {
+                       Relation        idescs[Num_pg_listener_indices];
  
+                       CatalogOpenIndices(Num_pg_listener_indices, 
+Name_pg_listener_indices, idescs);
+                       CatalogIndexInsert(idescs, Num_pg_listener_indices, lRel, 
+rTuple);
+                       CatalogCloseIndices(Num_pg_listener_indices, idescs);
+               }
+       }
        heap_endscan(sRel);
        heap_close(lRel, AccessExclusiveLock);
  }
***************
*** 467,473 ****
  
                        if (listenerPID == MyProcPid)
                        {
- 
                                /*
                                 * Self-notify: no need to bother with table update.
                                 * Indeed, we *must not* clear the notification field 
in
--- 476,481 ----



Reply via email to