Warning about LISTEN names

Started by Greg Sabino Mullaneover 19 years ago7 messagespatches
Jump to latest
#1Greg Sabino Mullane
greg@turnstep.com

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.

Index: listen.sgml
===================================================================
RCS file: /projects/cvsroot/pgsql/doc/src/sgml/ref/listen.sgml,v
retrieving revision 1.22
diff -c -r1.22 listen.sgml
*** listen.sgml 16 Sep 2006 00:30:19 -0000      1.22
--- listen.sgml 20 Feb 2007 18:18:15 -0000
***************
*** 33,38 ****
--- 33,44 ----
     class="PARAMETER">name</replaceable>.
     If the current session is already registered as a listener for
     this notification condition, nothing is done.
+    Note that because <replaceable class="PARAMETER">name</replaceable> 
+    is a relation name, all but the last section will be dropped if the 
+    name has any dots in it: LISTEN employee, LISTEN newyork.employee, 
+    and LISTEN unitedstates.newyork.employee all register the name 
+    employee. Users needing to separate words should use an underscore 
+    instead of a dot.
    </para>

<para>

#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: Greg Sabino Mullane (#1)
Re: Warning about LISTEN names

"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.

regards, tom lane

#3Neil Conway
neilc@samurai.com
In reply to: Greg Sabino Mullane (#1)
Re: Warning about LISTEN names

Greg Sabino Mullane said:

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.

Why not just change LISTEN, NOTIFY, and UNLISTEN to only accept an unqualified
identifier?

-Neil

#4Andrew Dunstan
andrew@dunslane.net
In reply to: Tom Lane (#2)
Re: Warning about LISTEN names

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.

Makes sense.

I'm still going to try to get notification payloads done for 8.3, which
will remove any requirement of catalog support and do it all in shared
memory.

Should we perhaps support a variant that allows a string as opposed to
an identifier as the name?

LISTEN
'really_really_really_really_really_really_really_really_really_really_really_really_long_name'
;

Or is that just silly? ;-)

cheers

andrew

#5Tom Lane
tgl@sss.pgh.pa.us
In reply to: Andrew Dunstan (#4)
Re: Warning about LISTEN names

Andrew Dunstan <andrew@dunslane.net> writes:

Tom Lane wrote:

Let's change it to a plain ColId, so you get a syntax error if you try
that.

Should we perhaps support a variant that allows a string as opposed to
an identifier as the name?

I think that'd just confuse matters. You can double-quote a string that
you want to use that isn't otherwise a valid identifier.

regards, tom lane

#6Bruce Momjian
bruce@momjian.us
In reply to: Tom Lane (#2)
Re: Warning about LISTEN names

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.

OK, so should I make this change for 8.3?

--
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. +

#7Bruce Momjian
bruce@momjian.us
In reply to: Tom Lane (#2)
Re: Warning about LISTEN names

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. +

Attachments:

/rtmp/difftext/x-diffDownload+18-18