473,396 Members | 1,879 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

(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

Nov 23 '05 #1
3 2112

On Sun, 15 Aug 2004, Frank van Vugt wrote:
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.


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

Nov 23 '05 #2
Frank van Vugt <ft**********@foxi.nl> writes:
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.


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

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


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 ma*******@postgresql.org so that your
message can get through to the mailing list cleanly

Nov 23 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

37
by: Zombie | last post by:
Hi, what is the correct way of converting contents of a <string> to lowercase? There are no methods of <string> class to do this so I fallback on strlwr(). But the c_str() method returns a const...
0
by: Marco Vezzoli | last post by:
Hi all, I'm using solaris 8 gcc 3.0.1 postgres 7.3.4 psycopg 1.1.2 apache 1.3.19 python 2.1.1 mod_python 2.7.8 compiled with DSO
9
by: mBird | last post by:
I wrote a service that listens for broadcast messages from my firewall (UDP snmp trap messages) and parses and puts the data in an database. I'd also like to write an app that is a simple form...
4
by: Glenn Sullivan | last post by:
Hi, I have been trying to get LISTEN/NOTIFY working in with JDBC. I cannot seem to get notified. I looked in the e-mail archive and saw a lot of similiar questions a couple of years ago. I...
4
by: Wayne Fang | last post by:
Hi, For various reasons (parallel structure with existing code, commonality of concepts, etc), we have C language functions implemented that use libpq to make a new connection to the same Postgres...
5
by: Ted Shab | last post by:
Hi, I'm trying to come up with a relatively simple multi-master replication solution. This is for multiple databases that need to be discreet, and change relatively infrequently (10-30 updates...
4
by: Jim Langston | last post by:
Is there any builtin lowercase std::string compare? Right now I'm doing this: if ( _stricmp( AmmoTypeText.c_str(), "GunBullet" ) == 0 ) AmmoType = Item_Ammo_GunBullet; Is there anything the...
6
by: Krij | last post by:
Hi! I wonder: is '<SCRIPT TYPE="TEXT/JAVASCRIPT1.2">' a correct way of starting? Or should it be kept in lowercase?
4
by: Christian Welzel | last post by:
Hi there, can somebody tell me if there is a mechanism in db2 which implements a notify/listen for external db clients? Postgres has such a mechanism where a client programm can connect to the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.