Help | Site Map
Connecting Tech Pros Worldwide
 
 
LinkBack Thread Tools
  #1  
Old November 23rd, 2005, 01:39 AM
Frank van Vugt
Guest
 
Posts: n/a
Default (libpq) listen/notify messages are converted to lowercase and/or are case insensitive

L.S.

Either the docs or I are missing something....

While using libpq I noticed that listen/notify calls were being converted to
lowercase. A further look showed that the listen/notify calls seem to be
totally case insensitive:

free4testing=# select version();
version
---------------------------------------------------------------------
PostgreSQL 7.4.3 on i686-pc-linux-gnu, compiled by GCC egcs-2.91.66

free4testing=# listen barcode_needed;
LISTEN
free4testing=# notify BARCODE_NEEDED;
NOTIFY
Asynchronous notification "barcode_needed" received from server process with
PID 32638.
free4testing=# unlisten BARCODE_NEEDED;
UNLISTEN
free4testing=#


Obviously, things work and they probably work as intended, but I wasn't able
to find anything on this behaviour in the docs. For a moment I thought that
the syntax rule 'unquoted letters are forced to lowercase' of SQL applied
here as well, but any double quotes used are simply interpreted as part of
the name.

Any further comments on this are appreciated.



--
Best,




Frank.


---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster

  #2  
Old November 23rd, 2005, 01:39 AM
Stephan Szabo
Guest
 
Posts: n/a
Default Re: (libpq) listen/notify messages are converted to


On Sun, 15 Aug 2004, Frank van Vugt wrote:
[color=blue]
> L.S.
>
> Either the docs or I are missing something....
>
> While using libpq I noticed that listen/notify calls were being converted to
> lowercase. A further look showed that the listen/notify calls seem to be
> totally case insensitive:
>
> free4testing=# select version();
> version
> ---------------------------------------------------------------------
> PostgreSQL 7.4.3 on i686-pc-linux-gnu, compiled by GCC egcs-2.91.66
>
> free4testing=# listen barcode_needed;
> LISTEN
> free4testing=# notify BARCODE_NEEDED;
> NOTIFY
> Asynchronous notification "barcode_needed" received from server process with
> PID 32638.
> free4testing=# unlisten BARCODE_NEEDED;
> UNLISTEN
> free4testing=#
>
>
> Obviously, things work and they probably work as intended, but I wasn't able
> to find anything on this behaviour in the docs. For a moment I thought that
> the syntax rule 'unquoted letters are forced to lowercase' of SQL applied
> here as well, but any double quotes used are simply interpreted as part of
> the name.[/color]

On my 7.4.2 machine, I can get:

sszabo=# listen foo;
LISTEN
sszabo=# notify "FOO";
NOTIFY
sszabo=# notify "foo";
NOTIFY
Asynchronous notification "foo" received from server process with PID
7042.
sszabo=# notify FOO;
NOTIFY
Asynchronous notification "foo" received from server process with PID
7042.

So, it looks to me that "FOO" is not being casefolded while FOO is, which
would be consistent with the identifier folding rules.


---------------------------(end of broadcast)---------------------------
TIP 8: explain analyze is your friend

  #3  
Old November 23rd, 2005, 01:39 AM
Tom Lane
Guest
 
Posts: n/a
Default Re: (libpq) listen/notify messages are converted to lowercase and/or are case insensitive

Frank van Vugt <ftm.van.vugt@foxi.nl> writes:[color=blue]
> Obviously, things work and they probably work as intended, but I wasn't able
> to find anything on this behaviour in the docs. For a moment I thought that
> the syntax rule 'unquoted letters are forced to lowercase' of SQL applied
> here as well, but any double quotes used are simply interpreted as part of
> the name.[/color]

You had the right idea: the arguments of listen and notify commands are
identifiers. I don't know what convinced you otherwise.

regression=# listen "Z";
LISTEN
regression=# notify Z;
NOTIFY
regression=# notify "Z";
NOTIFY
Asynchronous notification "Z" received from server process with PID 28818.
regression=# listen z;
LISTEN
regression=# notify "Z";
NOTIFY
Asynchronous notification "Z" received from server process with PID 28818.
regression=# notify Z;
NOTIFY
Asynchronous notification "z" received from server process with PID 28818.
regression=#

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster

  #4  
Old November 23rd, 2005, 01:39 AM
Frank van Vugt
Guest
 
Posts: n/a
Default Re: (libpq) listen/notify messages are converted to lowercase and/or are case insensitive

> You had the right idea: the arguments of listen and notify commands are[color=blue]
> identifiers. I don't know what convinced you otherwise.[/color]

Ah, this was the one I missed and somehow it confused me:

f4t=# listen "z";
LISTEN
f4t=# notify Z;
NOTIFY
Asynchronous notification "z" received from server process with PID 1800.
f4t=# notify "Z";
NOTIFY


Oh, and of course, _now_ the mentioning of 'identifier' in the notify-docs get
noticed as well ;)

Thanks to the both of you !



--
Best,




Frank.


---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to majordomo@postgresql.org so that your
message can get through to the mailing list cleanly

 

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over network members.
Post your question now . . .
It's fast and it's free

Popular Articles