Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

It's possible to delete a row in heroku postgresql?

I have a little problem here, I have a django app, that, somehow, in production DB created a row in a table that doesn't exists, with the same name as other row that does exists, ok, this might sound strange, but my question in really simple:

I have a DB in heroku that I can't delete, and I want to delete a single row of a table, or even that table (and only that one), but I don't know how to do it.

How can I do it?

like image 987
Sascuash Avatar asked Mar 20 '13 14:03

Sascuash


People also ask

How do I delete a specific row in PostgreSQL?

First, specify the table from which you want to delete data in the DELETE FROM clause. Second, specify which rows to delete by using the condition in the WHERE clause. The WHERE clause is optional. However, if you omit it, the DELETE statement will delete all rows in the table.

How do you delete a specific row in Pgadmin?

To delete a row, press the Delete toolbar button. A popup will open, asking you to confirm the deletion.


2 Answers

you can use the heroku cli with heroku pg:psql to connect directly to your PG instance and then issue and SQL commands you want to. Alternatively use a GUI connected to the database (info in the DATABASE_URL config key from heroku config) and do it from there.

like image 190
John Beynon Avatar answered Nov 14 '22 23:11

John Beynon


I'm a little late here, but this might help someone who stumbles across this thread...

If you go to your Heroku app's dashboard (through the website) > settings > "Reveal Config Vars" > DATABASE_URL, and then paste that URL into the browser.

I use TablePlus for database management, when I paste the link into the browser it asks if it can open TablePlus and then I can edit my production database in real time like I would in development.

I'm not sure what pasting the URL into the browser will do if you don't have TablePlus. I imagine it will request to open any other SQL management app you might have.

like image 28
Mason Avatar answered Nov 14 '22 23:11

Mason