Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

2 Answers
2

Even if it was possible: as you need to specify a database when you connect, the new database wouldn't be the one the user connected to (and there is no way to re-route the user to the newly created one).

In the LedgerSMB project we created a simple web app to create the database specified. Superuser logs in, it detects whether the db exists, and offers to create it if not. You could do the same thing here and have your help desk create the db's. Of course if you aren't doing the things we are doing you won't need to be superuser, just have the right to create databases (and, also roles, see below), so you may want the app to access the db as a superuser anyway but depending on your design you may not need to give out superuser credentials.

The other issue I can see is that the database isn't the only thing you will have to create. ident sameuser/peer authentication works fine, but it requires that the user account exists in both the system and the database. So your app will need to create the role as well. For those with ident access that means they are logging into the shell first, and then into the db, right? So I assume that a shell script might be sufficient as well.