About 51 results
Open links in new tab
  1. How to drop PostgreSQL database through command line

    I'm trying to drop my database and create a new one through the command line. I log in using psql -U username and then do a \\connect template1, followed by a DROP DATABASE databasename;. I get …

  2. postgresql - Postgres drop database error: pq: cannot drop the ...

    Apr 8, 2016 · Because, you are trying to execute dropDb command on database, to which you have open connection. According to postgres documentation: You cannot be connected to the database …

  3. postgresql - PSQL Drop database with FORCE - Stack Overflow

    Sep 27, 2023 · Works for me. 1) Are you sure you are connected to a Postgres 13+ database? What does select version() return? 2) What psql version are you using? 3) Did you copy/paste this query …

  4. postgresql - drop db in postgres - Stack Overflow

    Nov 16, 2012 · The sudo -u postgres psql connects to postgres database. You need to specify database: sudo -u postgres psql mydbname and then you can use metdata commands like \d, \dt, …

  5. How to drop a PostgreSQL database if there are active connections to …

    Mar 23, 2011 · 871 I need to write a script that will drop a PostgreSQL database. There may be a lot of connections to it, but the script should ignore that. The standard DROP DATABASE db_name query …

  6. Cannot drop PostgreSQL role. Error: `cannot be dropped because some ...

    Jul 10, 2018 · DROP USER (or DROP ROLE, same thing) cannot proceed while the role still owns anything or has any granted privileges on other objects. Get rid of all privileges with DROP OWNED …

  7. How can I drop all the tables in a PostgreSQL database?

    How can I drop all tables in PostgreSQL, working from the command line? I don't want to drop the database itself, just all tables and all the data in them.

  8. PostgreSQL: Drop Database but DB is still there [duplicate]

    Jan 28, 2012 · PostgreSQL: Drop Database but DB is still there [duplicate] Asked 14 years, 2 months ago Modified 5 years, 6 months ago Viewed 35k times

  9. Postgresql - unable to drop database because of some auto …

    107 Update in Postgresql 13 You could just use this command to drop a Database forcefully, thus disconnecting each user/app connected to it. ... You could check the manual for more. FORCE - …

  10. Postgres: clear entire database before re-creating / re-populating from ...

    Jan 13, 2010 · To drop and recreate tables, you could use the --clean command-line option for pg_dump to emit SQL commands to clean (drop) database objects prior to (the commands for) creating them.