Re: How to drop automatically some databases? - Mailing list pgsql-admin

From David G. Johnston
Subject Re: How to drop automatically some databases?
Date
Msg-id CAKFQuwaH847+9o-3=KHsdokP3t=YEJRpF3MSzL91axv0vZxEXA@mail.gmail.com
Whole thread Raw
In response to How to drop automatically some databases?  (Andreas <maps.on@gmx.net>)
List pgsql-admin
On Saturday, April 25, 2015, Andreas <maps.on@gmx.net> wrote:
drop database ( ... the select above ... )

in the DB "postgres" but it didn't work.
After a couple of seconds I get a syntax error.

What now?   :}


You have to use dynamic sql - either using plpgsql so something in your client of choice (e.g. psql).  Drop database is DSL and does not accept database names as parameters or via column references.

David J. 

pgsql-admin by date:

Previous
From: Andreas
Date:
Subject: How to drop automatically some databases?
Next
From: Andre_Mikulec
Date:
Subject: How do I install/run PostgreSQL 9.4 64 bit on Windows 7 Professional?