From: | "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com> |
---|---|
To: | Christophe Pettus <xof(at)thebuild(dot)com> |
Cc: | H <agents(at)meddatainc(dot)com>, PostgreSQL Users Mailing List <pgsql-general(at)lists(dot)postgresql(dot)org> |
Subject: | Re: Dropping all tables in a database |
Date: | 2023-08-07 01:31:17 |
Message-ID: | CAKFQuwYKxQrEHQbahS9Dj_iqJMXzNhgLFVCqJxnSSPDmnvKEkg@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On Sun, Aug 6, 2023, 18:25 Christophe Pettus <xof(at)thebuild(dot)com> wrote:
>
>
> > On Aug 6, 2023, at 18:17, H <agents(at)meddatainc(dot)com> wrote:
> >
> > Is there some setting I have to change in the database to have the first
> SQL statement to work or have I run into a possible bug?
>
> The first statement just generates a line of text output that contains the
> statement. There's nothing in it that would cause that statement to be
> executed.
>
> If you want to create a statement dynamically and then execute it, you can
> do that with pl/pgSQL:
>
>
> https://www.postgresql.org/docs/current/plpgsql-statements.html#PLPGSQL-STATEMENTS-EXECUTING-DYN
>
> Otherwise, the solution is to do as you did: write the output to a file,
> trim out any extraneous lines, and then use that as a script.
>
Or in psql execute it using the \gexec meta-command instead of a semi-colon.
David J.
>
From | Date | Subject | |
---|---|---|---|
Next Message | Thorsten Glaser | 2023-08-07 02:19:50 | Re: Dropping all tables in a database |
Previous Message | Julien Rouhaud | 2023-08-07 01:29:09 | Re: Dropping all tables in a database |