Re: Dropping all tables in a database

2023-08-07 Thread H
On 08/06/2023 09:24 PM, Christophe Pettus wrote: > >> On Aug 6, 2023, at 18:17, H 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 conta

Re: Dropping all tables in a database

2023-08-06 Thread Thomas Kellerer
H schrieb am 07.08.2023 um 03:17: > I am running PostgreSQL 13.11 and tried to drop all tables in a > database without dropping the database or schema. After logging in as > the correct user, the following SQL statement does not work: > > SELECT 'DROP TABLE IF EXISTS "' || tablename || '" CASCADE

Re: Dropping all tables in a database

2023-08-06 Thread Thorsten Glaser
On Sun, 6 Aug 2023, H wrote: >I am running PostgreSQL  13.11 and tried to drop all tables in a >database without dropping the database or schema. See: https://evolvis.org/plugins/scmgit/cgi-bin/gitweb.cgi?p=useful-scripts/useful-scripts.git;a=tree;f=SQL;hb=HEAD Comments welcome (especially a fix

Re: Dropping all tables in a database

2023-08-06 Thread David G. Johnston
On Sun, Aug 6, 2023, 18:25 Christophe Pettus wrote: > > > > On Aug 6, 2023, at 18:17, H 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

Re: Dropping all tables in a database

2023-08-06 Thread Julien Rouhaud
On Mon, Aug 7, 2023 at 9:25 AM Christophe Pettus wrote: > > > On Aug 6, 2023, at 18:17, H 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 out

Re: Dropping all tables in a database

2023-08-06 Thread Christophe Pettus
> On Aug 6, 2023, at 18:17, H 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 woul

Dropping all tables in a database

2023-08-06 Thread H
I am running PostgreSQL  13.11 and tried to drop all tables in a database without dropping the database or schema. After logging in as the correct user, the following SQL statement does not work: SELECT 'DROP TABLE IF EXISTS "' || tablename || '" CASCADE;' FROM pg_tables WHERE schemaname = 'pub