pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
BUG #5911: pg_notify() function only works when channel name is lower case
4+ messages / 4 participants
[nested] [flat]

* BUG #5911: pg_notify() function only works when channel name is lower case
@ 2011-03-03 15:20 Joshua McDougall <josh@schemaverse.com>
  2011-03-03 16:22 ` Re: BUG #5911: pg_notify() function only works when channel name is lower case Merlin Moncure <mmoncure@gmail.com>
  2011-03-03 16:24 ` Re: BUG #5911: pg_notify() function only works when channel name is lower case Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 2 replies; 4+ messages in thread

From: Joshua McDougall @ 2011-03-03 15:20 UTC (permalink / raw)
  To: pgsql-bugs


The following bug has been logged online:

Bug reference:      5911
Logged by:          Joshua McDougall
Email address:      josh@schemaverse.com
PostgreSQL version: 9.0.3
Operating system:   Slackware Linux  Kernel  2.6.28.6
Description:        pg_notify() function only works when channel name is
lower case
Details: 

When using the pg_notify(text,text) function, the channel name MUST be lower
case otherwise the message does not go through.

So, while this will work:

LISTEN ERRORCHANNEL; 
NOTIFY ERRORCHANNEL, 'something!'; 
NOTIFY eRrorChanNel, 'something!';

this will not:
SELECT pg_notify('ERRORCHANNEL','something!');

You must use:
SELECT pg_notify('errorchannel','something!');



^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: BUG #5911: pg_notify() function only works when channel name is lower case
  2011-03-03 15:20 BUG #5911: pg_notify() function only works when channel name is lower case Joshua McDougall <josh@schemaverse.com>
@ 2011-03-03 16:22 ` Merlin Moncure <mmoncure@gmail.com>
  1 sibling, 0 replies; 4+ messages in thread

From: Merlin Moncure @ 2011-03-03 16:22 UTC (permalink / raw)
  To: Joshua McDougall <josh@schemaverse.com>; +Cc: pgsql-bugs

On Thu, Mar 3, 2011 at 9:20 AM, Joshua McDougall <josh@schemaverse.com> wrote:
>
> The following bug has been logged online:
>
> Bug reference:      5911
> Logged by:          Joshua McDougall
> Email address:      josh@schemaverse.com
> PostgreSQL version: 9.0.3
> Operating system:   Slackware Linux  Kernel  2.6.28.6
> Description:        pg_notify() function only works when channel name is
> lower case
> Details:
>
> When using the pg_notify(text,text) function, the channel name MUST be lower
> case otherwise the message does not go through.
>
> So, while this will work:
>
> LISTEN ERRORCHANNEL;
> NOTIFY ERRORCHANNEL, 'something!';
> NOTIFY eRrorChanNel, 'something!';
>
> this will not:
> SELECT pg_notify('ERRORCHANNEL','something!');
>
> You must use:
> SELECT pg_notify('errorchannel','something!');

not a bug. you have to double quote relnames (listen "Test"). if you
want the server not to case fold them. pg_notify takes a string, not a
relname, which uses different rules.

merlin



^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: BUG #5911: pg_notify() function only works when channel name is lower case
  2011-03-03 15:20 BUG #5911: pg_notify() function only works when channel name is lower case Joshua McDougall <josh@schemaverse.com>
@ 2011-03-03 16:24 ` Tom Lane <tgl@sss.pgh.pa.us>
  2011-03-03 16:41   ` Re: BUG #5911: pg_notify() function only works when channel name is lower case Josh <josh@schemaverse.com>
  1 sibling, 1 reply; 4+ messages in thread

From: Tom Lane @ 2011-03-03 16:24 UTC (permalink / raw)
  To: Joshua McDougall <josh@schemaverse.com>; +Cc: pgsql-bugs

"Joshua McDougall" <josh@schemaverse.com> writes:
> When using the pg_notify(text,text) function, the channel name MUST be lower
> case otherwise the message does not go through.

It's not clear to me that this is a bug.  The argument of NOTIFY is a
SQL identifier, which is folded to lower case by the lexer if not
double-quoted, but the argument of pg_notify is a string constant which
is a different matter altogether.

We could have pg_notify lowercase its argument at runtime, but then
we'd have to introduce quoting rules, so that you could do

	select pg_notify('"IntentionallyMixedCase"', '...');

This isn't a lot clearer than the current behavior, and it definitely
wouldn't be backwards compatible.  So I'm inclined to leave it alone.

			regards, tom lane



^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: BUG #5911: pg_notify() function only works when channel name is lower case
  2011-03-03 15:20 BUG #5911: pg_notify() function only works when channel name is lower case Joshua McDougall <josh@schemaverse.com>
  2011-03-03 16:24 ` Re: BUG #5911: pg_notify() function only works when channel name is lower case Tom Lane <tgl@sss.pgh.pa.us>
@ 2011-03-03 16:41   ` Josh <josh@schemaverse.com>
  0 siblings, 0 replies; 4+ messages in thread

From: Josh @ 2011-03-03 16:41 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; mmoncure@gmail.com; +Cc: pgsql-bugs

Thank you both for clearing that up (and doing so quite quickly!).
The behavior makes complete sense now that I understand what is 
happening here behind the scenes.

Regards,
Josh

On 3/3/2011 11:24 AM, Tom Lane wrote:
> "Joshua McDougall"<josh@schemaverse.com>  writes:
>> When using the pg_notify(text,text) function, the channel name MUST be lower
>> case otherwise the message does not go through.
> It's not clear to me that this is a bug.  The argument of NOTIFY is a
> SQL identifier, which is folded to lower case by the lexer if not
> double-quoted, but the argument of pg_notify is a string constant which
> is a different matter altogether.
>
> We could have pg_notify lowercase its argument at runtime, but then
> we'd have to introduce quoting rules, so that you could do
>
> 	select pg_notify('"IntentionallyMixedCase"', '...');
>
> This isn't a lot clearer than the current behavior, and it definitely
> wouldn't be backwards compatible.  So I'm inclined to leave it alone.
>
> 			regards, tom lane




^ permalink  raw  reply  [nested|flat] 4+ messages in thread


end of thread, other threads:[~2011-03-03 16:41 UTC | newest]

Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2011-03-03 15:20 BUG #5911: pg_notify() function only works when channel name is lower case Joshua McDougall <josh@schemaverse.com>
2011-03-03 16:22 ` Merlin Moncure <mmoncure@gmail.com>
2011-03-03 16:24 ` Tom Lane <tgl@sss.pgh.pa.us>
2011-03-03 16:41   ` Josh <josh@schemaverse.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox