Re: How to drop automatically some databases?

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: Andreas <maps(dot)on(at)gmx(dot)net>
Cc: "pgsql-admin(at)postgresql(dot)org" <pgsql-admin(at)postgresql(dot)org>
Subject: Re: How to drop automatically some databases?
Date: 2015-04-25 16:25:38
Message-ID: CAKFQuwaH847+9o-3=KHsdokP3t=YEJRpF3MSzL91axv0vZxEXA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

On Saturday, April 25, 2015, Andreas <maps(dot)on(at)gmx(dot)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.

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message Peter Geoghegan 2015-04-27 01:02:06 INSERT ... ON CONFLICT UPDATE/IGNORE 4.0
Previous Message Andreas 2015-04-25 12:07:59 How to drop automatically some databases?