Sample Header Ad - 728x90

Check if postgresql database exists (case insensitive way)

22 votes
3 answers
46609 views
Is there a "elegant built-in" case-insensitive way to check if db is exists? I've found only SELECT datname FROM pg_catalog.pg_database WHERE datname='dbname', but this is a CS check. The first thing that comes to mind to retrieve all db names and filter them by hand, but I think there is more elegant way to do it.
Asked by Andrei Orlov (537 rep)
Jun 24, 2013, 10:46 AM
Last activity: Apr 5, 2024, 03:02 PM