Change pg_listener attribute number constants to match the usual pattern
authorPeter Eisentraut <peter_e@gmx.net>
Tue, 21 Jul 2009 20:24:51 +0000 (20:24 +0000)
committerPeter Eisentraut <peter_e@gmx.net>
Tue, 21 Jul 2009 20:24:51 +0000 (20:24 +0000)
It appears that, for no particularly good reason, pg_listener.h deviates from
the usual convention for declaring attribute number constants.  Normally, it's

#define Anum_{catalog-name}_{column-name}  {attribute-number}

pg_listener.h, however substitutes a different string that is similar, but not
the same as, the column name.  This change fixes that.

Author: Robert Haas <robertmhaas@gmail.com>

src/backend/commands/async.c
src/include/catalog/pg_listener.h

index 76f7ba2b250ad771c20e35d3a852aabaee196ddc..89c2bc58ee4c9838de84f21eea525e5426d333f1 100644 (file)
@@ -486,8 +486,8 @@ Exec_Listen(Relation lRel, const char *relname)
 
        namestrcpy(&condname, relname);
        values[Anum_pg_listener_relname - 1] = NameGetDatum(&condname);
-       values[Anum_pg_listener_pid - 1] = Int32GetDatum(MyProcPid);
-       values[Anum_pg_listener_notify - 1] = Int32GetDatum(0);         /* no notifies pending */
+       values[Anum_pg_listener_listenerpid - 1] = Int32GetDatum(MyProcPid);
+       values[Anum_pg_listener_notification - 1] = Int32GetDatum(0);           /* no notifies pending */
 
        tuple = heap_form_tuple(RelationGetDescr(lRel), values, nulls);
 
@@ -567,7 +567,7 @@ Exec_UnlistenAll(Relation lRel)
 
        /* Find and delete all entries with my listenerPID */
        ScanKeyInit(&key[0],
-                               Anum_pg_listener_pid,
+                               Anum_pg_listener_listenerpid,
                                BTEqualStrategyNumber, F_INT4EQ,
                                Int32GetDatum(MyProcPid));
        scan = heap_beginscan(lRel, SnapshotNow, 1, key);
@@ -598,9 +598,9 @@ Send_Notify(Relation lRel)
        /* preset data to update notify column to MyProcPid */
        memset(nulls, false, sizeof(nulls));
        memset(repl, false, sizeof(repl));
-       repl[Anum_pg_listener_notify - 1] = true;
+       repl[Anum_pg_listener_notification - 1] = true;
        memset(value, 0, sizeof(value));
-       value[Anum_pg_listener_notify - 1] = Int32GetDatum(MyProcPid);
+       value[Anum_pg_listener_notification - 1] = Int32GetDatum(MyProcPid);
 
        scan = heap_beginscan(lRel, SnapshotNow, 0, NULL);
 
@@ -978,7 +978,7 @@ ProcessIncomingNotify(void)
 
        /* Scan only entries with my listenerPID */
        ScanKeyInit(&key[0],
-                               Anum_pg_listener_pid,
+                               Anum_pg_listener_listenerpid,
                                BTEqualStrategyNumber, F_INT4EQ,
                                Int32GetDatum(MyProcPid));
        scan = heap_beginscan(lRel, SnapshotNow, 1, key);
@@ -986,9 +986,9 @@ ProcessIncomingNotify(void)
        /* Prepare data for rewriting 0 into notification field */
        memset(nulls, false, sizeof(nulls));
        memset(repl, false, sizeof(repl));
-       repl[Anum_pg_listener_notify - 1] = true;
+       repl[Anum_pg_listener_notification - 1] = true;
        memset(value, 0, sizeof(value));
-       value[Anum_pg_listener_notify - 1] = Int32GetDatum(0);
+       value[Anum_pg_listener_notification - 1] = Int32GetDatum(0);
 
        while ((lTuple = heap_getnext(scan, ForwardScanDirection)) != NULL)
        {
index 7e02e69e4059b648749016db6780a131b8ebfffc..8693e738c79193a7805cea2a3d4390f075d38770 100644 (file)
@@ -48,8 +48,8 @@ typedef FormData_pg_listener *Form_pg_listener;
  */
 #define Natts_pg_listener                                              3
 #define Anum_pg_listener_relname                               1
-#define Anum_pg_listener_pid                                   2
-#define Anum_pg_listener_notify                                        3
+#define Anum_pg_listener_listenerpid                   2
+#define Anum_pg_listener_notification                  3
 
 /* ----------------
  *             initial contents of pg_listener are NOTHING.