Nov 142013

I found a problem with the check_pgsql Nagios plugin last week. It can’t handle names such as It’s a valid database name, as witnessed here:

$ psql -l | grep freshports
freshports.old | dan    | SQL_ASCII | C       | C     | | dan    | SQL_ASCII | C       | C     | 

But it doesn’t work:

$ /usr/local/libexec/nagios/check_pgsql  -H slocum -l www -d
check_pgsql: Database name is not valid -
check_pgsql [-H ] [-P ] [-c ] [-w ]
 [-t ] [-d ] [-l ] [-p ]

Hmm, what’s up with that. Looking at the source code, I found this comment:

Valid PostgreSQL database names are less than &NAMEDATALEN;
characters long and consist of letters, numbers, and underscores. The
first character cannot be a number, however.

This seems to be true for most identifiers (a database name is an identifier). But you can also use quoted identifiers, such as “”. To quote: “Quoted identifiers can contain any character, except the character with code zero.

In the meantime, I’ve created another database and I’m testing that one can connect.

Website Pin Facebook Twitter Myspace Friendfeed Technorati Digg Google StumbleUpon Premium Responsive