473,739 Members | 7,912 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

(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 2137

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**********@f oxi.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*******@postg resql.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
7355
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 pointer which cannot be used with strlwr() as it does the conversion inplace. So, I use the following logic of copying the contents to a dynamically allocated char* array and then doing the conversion: -----------------------------
0
1389
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
43146
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 that can listen in when it runs (so I can see messages in a form as they occur.) So I need the ability to listen to a UDP port with two apps at the same time (the service and my app). But when I do that I get an error:...
4
7078
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 never could find any answers in the e-mail nor in the documentation. Perhaps I just missed it. I have tried the following code snipit: Connection db = DriverManager.getConnection(url, user, passwd);
4
1607
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 server. Yes, I realize libpq is meant for clients and SPI for backends. The question is, are there any technical problems with this? Will using libpq in the backend do Bad Things in unexpected areas/ways? The environment ranges from: Postgres...
5
3428
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 an hour), and almost never update each others data (less than once a day). The TCL-based replication project for multi-master is
4
24881
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 standard library to do this? I'm not interested in Boost until it becomes part of the standard.
6
2494
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
2414
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 db and send a "listen <name>" sql command and then gets a message if someone in the system issued a "notify <name>". This way the client does not need to poll the database if it wants to be uptodate to the current table status.
0
8969
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8792
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
9266
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9209
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8215
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6754
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6054
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4570
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
2748
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.