Re: Warning about LISTEN names - Mailing list pgsql-patches

From Bruce Momjian
Subject Re: Warning about LISTEN names
Date
Msg-id 200704022219.l32MJqg09226@momjian.us
Whole thread Raw
In response to Re: Warning about LISTEN names  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-patches
Tom Lane wrote:
> "Greg Sabino Mullane" <greg@turnstep.com> writes:
> > I'll save the full rant for my blog :), but wanted to submit this documentation
> > patch for this listen gotcha that's been bugging me for a while. I'd like
> > to see LISTEN and NOTIFY changed to use a simple text string, but until then,
> > I think we should probably warn about the chopping off of the left-hand part.
>
> Let's change it to a plain ColId, so you get a syntax error if you try
> that.

With no comment from my question of status, I have implemented this
idea.  Patch attached and applied.

--
  Bruce Momjian  <bruce@momjian.us>          http://momjian.us
  EnterpriseDB                               http://www.enterprisedb.com

  + If your life is a hard drive, Christ can be your backup. +
Index: src/backend/parser/gram.y
===================================================================
RCS file: /cvsroot/pgsql/src/backend/parser/gram.y,v
retrieving revision 2.585
diff -c -c -r2.585 gram.y
*** src/backend/parser/gram.y    2 Apr 2007 03:49:38 -0000    2.585
--- src/backend/parser/gram.y    2 Apr 2007 21:57:48 -0000
***************
*** 4834,4860 ****
   *
   *****************************************************************************/

! NotifyStmt: NOTIFY qualified_name
                  {
                      NotifyStmt *n = makeNode(NotifyStmt);
!                     n->relation = $2;
                      $$ = (Node *)n;
                  }
          ;

! ListenStmt: LISTEN qualified_name
                  {
                      ListenStmt *n = makeNode(ListenStmt);
!                     n->relation = $2;
                      $$ = (Node *)n;
                  }
          ;

  UnlistenStmt:
!             UNLISTEN qualified_name
                  {
                      UnlistenStmt *n = makeNode(UnlistenStmt);
!                     n->relation = $2;
                      $$ = (Node *)n;
                  }
              | UNLISTEN '*'
--- 4834,4866 ----
   *
   *****************************************************************************/

! NotifyStmt: NOTIFY ColId
                  {
                      NotifyStmt *n = makeNode(NotifyStmt);
!                     n->relation = makeNode(RangeVar);
!                     n->relation->relname = $2;
!                     n->relation->schemaname = NULL;
                      $$ = (Node *)n;
                  }
          ;

! ListenStmt: LISTEN ColId
                  {
                      ListenStmt *n = makeNode(ListenStmt);
!                     n->relation = makeNode(RangeVar);
!                     n->relation->relname = $2;
!                     n->relation->schemaname = NULL;
                      $$ = (Node *)n;
                  }
          ;

  UnlistenStmt:
!             UNLISTEN ColId
                  {
                      UnlistenStmt *n = makeNode(UnlistenStmt);
!                     n->relation = makeNode(RangeVar);
!                     n->relation->relname = $2;
!                     n->relation->schemaname = NULL;
                      $$ = (Node *)n;
                  }
              | UNLISTEN '*'

pgsql-patches by date:

Previous
From: Tom Lane
Date:
Subject: Re: Current enums patch
Next
From: Bruce Momjian
Date:
Subject: Re: Updateable cursors patch