From: H <agents@meddatainc.com>
To: PostgreSQL Users Mailing List <pgsql-general@lists.postgresql.org>
Subject: Re: Dropping all tables in a database
Date: Mon, 7 Aug 2023 20:59:29 -0400
Message-ID: <1cbbb815-fd38-9cf6-86db-eeb57b229342@meddatainc.com> (raw)
In-Reply-To: <A645BF48-B811-425B-B924-0E7E094E7C46@thebuild.com>
References: <ca828fc5-4ab6-f365-cb69-8076dee6e808@meddatainc.com>
<A645BF48-B811-425B-B924-0E7E094E7C46@thebuild.com>
On 08/06/2023 09:24 PM, Christophe Pettus wrote:
>
>> On Aug 6, 2023, at 18:17, H <agents@meddatainc.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.
Oops, you are right, thank you. I worked around it by making sure the database to be restored is saved using the options --clean, --if-exists and --no-owner which solve my problem.
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-general@postgresql.org
Cc: agents@meddatainc.com
Subject: Re: Dropping all tables in a database
In-Reply-To: <1cbbb815-fd38-9cf6-86db-eeb57b229342@meddatainc.com>
References: <ca828fc5-4ab6-f365-cb69-8076dee6e808@meddatainc.com> <A645BF48-B811-425B-B924-0E7E094E7C46@thebuild.com> <1cbbb815-fd38-9cf6-86db-eeb57b229342@meddatainc.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox