Live-editing a PostgreSQL database on a production server ... the only way to handle your data.
$ su - pguser $ psql psql (9.4.3) Type "help" for help. pguser=# \du ... lists roles pguser=# \l ... lists databases pguser=# \connect pm1 You are now connected to database "pm1" as user "pguser". pm1=# \q $
Same thing but faster - if you already know the psql database name before you get started:
$ psql pm1 psql (9.4.3) Type "help" for help. pm1=# \d ... lists tables in the DB
I admit that I knew - from a text backup - what the ID number I needed to remove was.
pm1=# select * from locations; ... shows a big table of all locations pm1=# select * from locations where id = 247; ... shows a table with only one line
Confirming the search had only the one result was important. Now we can delete it with slightly more confidence:
pm1=# delete from locations where id = 247; DELETE 1 pm1=# \q $