Skip to content

Commit 5dedce6

Browse files
committed
Change pg_listener attribute number constants to match the usual pattern
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>
1 parent ab5b4e2 commit 5dedce6

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

src/backend/commands/async.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* Portions Copyright (c) 1994, Regents of the University of California
88
*
99
* IDENTIFICATION
10-
* $PostgreSQL: pgsql/src/backend/commands/async.c,v 1.147 2009/06/11 14:48:55 momjian Exp $
10+
* $PostgreSQL: pgsql/src/backend/commands/async.c,v 1.148 2009/07/21 20:24:51 petere Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -486,8 +486,8 @@ Exec_Listen(Relation lRel, const char *relname)
486486

487487
namestrcpy(&condname, relname);
488488
values[Anum_pg_listener_relname - 1] = NameGetDatum(&condname);
489-
values[Anum_pg_listener_pid - 1] = Int32GetDatum(MyProcPid);
490-
values[Anum_pg_listener_notify - 1] = Int32GetDatum(0); /* no notifies pending */
489+
values[Anum_pg_listener_listenerpid - 1] = Int32GetDatum(MyProcPid);
490+
values[Anum_pg_listener_notification - 1] = Int32GetDatum(0); /* no notifies pending */
491491

492492
tuple = heap_form_tuple(RelationGetDescr(lRel), values, nulls);
493493

@@ -567,7 +567,7 @@ Exec_UnlistenAll(Relation lRel)
567567

568568
/* Find and delete all entries with my listenerPID */
569569
ScanKeyInit(&key[0],
570-
Anum_pg_listener_pid,
570+
Anum_pg_listener_listenerpid,
571571
BTEqualStrategyNumber, F_INT4EQ,
572572
Int32GetDatum(MyProcPid));
573573
scan = heap_beginscan(lRel, SnapshotNow, 1, key);
@@ -598,9 +598,9 @@ Send_Notify(Relation lRel)
598598
/* preset data to update notify column to MyProcPid */
599599
memset(nulls, false, sizeof(nulls));
600600
memset(repl, false, sizeof(repl));
601-
repl[Anum_pg_listener_notify - 1] = true;
601+
repl[Anum_pg_listener_notification - 1] = true;
602602
memset(value, 0, sizeof(value));
603-
value[Anum_pg_listener_notify - 1] = Int32GetDatum(MyProcPid);
603+
value[Anum_pg_listener_notification - 1] = Int32GetDatum(MyProcPid);
604604

605605
scan = heap_beginscan(lRel, SnapshotNow, 0, NULL);
606606

@@ -978,17 +978,17 @@ ProcessIncomingNotify(void)
978978

979979
/* Scan only entries with my listenerPID */
980980
ScanKeyInit(&key[0],
981-
Anum_pg_listener_pid,
981+
Anum_pg_listener_listenerpid,
982982
BTEqualStrategyNumber, F_INT4EQ,
983983
Int32GetDatum(MyProcPid));
984984
scan = heap_beginscan(lRel, SnapshotNow, 1, key);
985985

986986
/* Prepare data for rewriting 0 into notification field */
987987
memset(nulls, false, sizeof(nulls));
988988
memset(repl, false, sizeof(repl));
989-
repl[Anum_pg_listener_notify - 1] = true;
989+
repl[Anum_pg_listener_notification - 1] = true;
990990
memset(value, 0, sizeof(value));
991-
value[Anum_pg_listener_notify - 1] = Int32GetDatum(0);
991+
value[Anum_pg_listener_notification - 1] = Int32GetDatum(0);
992992

993993
while ((lTuple = heap_getnext(scan, ForwardScanDirection)) != NULL)
994994
{

src/include/catalog/pg_listener.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group
88
* Portions Copyright (c) 1994, Regents of the University of California
99
*
10-
* $PostgreSQL: pgsql/src/include/catalog/pg_listener.h,v 1.25 2009/01/01 17:23:57 momjian Exp $
10+
* $PostgreSQL: pgsql/src/include/catalog/pg_listener.h,v 1.26 2009/07/21 20:24:51 petere Exp $
1111
*
1212
* NOTES
1313
* the genbki.sh script reads this file and generates .bki
@@ -48,8 +48,8 @@ typedef FormData_pg_listener *Form_pg_listener;
4848
*/
4949
#define Natts_pg_listener 3
5050
#define Anum_pg_listener_relname 1
51-
#define Anum_pg_listener_pid 2
52-
#define Anum_pg_listener_notify 3
51+
#define Anum_pg_listener_listenerpid 2
52+
#define Anum_pg_listener_notification 3
5353

5454
/* ----------------
5555
* initial contents of pg_listener are NOTHING.

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy