{{Category: PostgreSQL}}

PostgreSQL Fix Duplicates in Database

  • Ivan Ivanov
  • PostgreSQL
PostgreSQL Fix Duplicates in Database

This usually happens when bringing a Site from Dev to Live. There is a easy fix for this though that has never let me down.
EG: Duplicates are in Table articles. We access PostgreSQL DB with psql database_name than we execute below to get rid of the duplicates. 
DELETE FROM articles [...]

Read More

Dump PostgreSQL without Owner & Privileges

  • Ivan Ivanov
  • PostgreSQL
Dump PostgreSQL without Owner & Privileges

If you ever wanted to dump your PostgreSQL Development Database without the Owner and the Privileges, then you just need to run the following command:
pg_dump database_name -O -x > output_file

Read More

PostgreSQL How-to Change Owner for All Tables

  • Ivan Ivanov
  • PostgreSQL
PostgreSQL How-to Change Owner for All Tables

When moving websites between servers the database user often changes. While it is easy to dump and restore database dumps using pg_dump and pg_restore this might lead to invalid table ownership's on the new host. This bash script will easily fix this issue.
/usr/local/bin/alter
#!/bin/bash
Read More