Failed to add site to database. DBERR: error ‘ERROR: duplicate key violates unique constraint “domain_key” ‘ in ‘ INSERT INTO siteinfo ENSIM

March 6, 2009 on 9:30 am | In Pgsql, ensim | 3 Comments

Hello guys, You might have come accross the following error

Failed to add site to database. DBERR: error ‘ERROR: duplicate key violates unique constraint “domain_key” ‘ in ‘ INSERT INTO siteinfo (site_id, domain, admin_user, email) VALUES (8, ‘domain.com’, ‘xxxx’, ‘xxx@domain.com’)’

=========================

Here is the fix.

Login to server via backend.

su postgres

Take a backup of the database…

pg_dump appldb > appldb.dump.out

Now lets edit

psql

postgres=# \l

this will list all the databases. The Ensim database is “appldb”

postgres=# \c appldb
You are now connected to database “appldb”.
appldb=# \d

This will list all the tables in the database.

You can find the database siteinfo

appldb=# SELECT * FROM siteinfo WHERE domain=’domain.com’;

site_id | domain | email | admin_user
———+——————–+———————+————
35 |domain.com | test@yahoo.com | dommn
(1 row)
it will list the entry. Now to fix the issue, you need to delete that entry. Find the site_id for the domain. Here it is 35

DELETE FROM siteinfo WHERE site_id=35;

Now quit the database

appldb=# \q

bash-3.00$ exit

Restart services

/etc/rc.d/init.d/virtualhosting restart

/etc/rc.d/init.d/epld restart

Now try to add the domain from Control panel. :)

PostgreSQL Installation in RHEL pgsql

June 10, 2008 on 5:08 pm | In Pgsql | No Comments

This is for fresh install. If you are going for an upgrade, you need to check out the steps from the link.

==============

http://www.postgresonline.com/journal/index.php?/archives/45-An-Almost-Idiots-Guide-to-PostgreSQL-YUM.html

==============

It is easy to install it via yum or up2date.
However, if you need a specific version, it is better to go for rpm installation.

Using yum

==============
yum groupinstall postgresql
==============

Using up2date.

==============
up2date @ postgresql
==============

Using rpm. You need three rpm.

==============
postgresql-libs--1PGDG.rhel
postgresql-server--1PGDG.rhel
postgresql--1PGDG.rhel
==============

Download the RPM from rpm.pbone.net for your coresponding OS and the required version.

dowload it to

==============
/usr/local/src/
==============

Install them using

==============
rpm -ivh postgresql-libs--1PGDG.rhel
rpm -ivh postgresql-server--1PGDG.rhel
rpm -ivh postgresql--1PGDG.rhel
==============

Once you have completed this you need can start the service.

==============
/etc/rc.d/init.d/postgresql start
==============

Edit the file ‘/var/lib/pgsql/data/pg_hba.conf’, replace all entries of “ident sameuser” with “trust”.
Edit the file ‘/var/lib/pgsql/data/postgresql.conf’, change the line “max_connections=100″ to atleast max_connections=500″.

Restart PostgreSQL.

If the initialisation fails the files pg_hba.conf and postgresql.conf will not be created.
In such a case, perform the following operation.

Check the startup log which is found in /var/lib/pgsql/

==============
chown postgres /var/lib/pgsql/data
su postgres
initdb –D /var/lib/pgsql/data
==============

To make sure it starts automatically on boot – do the following command

==============
chkconfig –list
chkconfig postgresql on
==============

Kill all the currently running postgre processes.

==================
ps aux | grep post
==================

==================
kill -9 …..
==================

Try starting it again.
:)

How to install pdo_pgsql in Cpanel server

April 23, 2008 on 2:51 pm | In Installation, PHP, Pgsql | No Comments

Its that easy to add the php module pdo_pgsql in a Cpanel server.

Just use the command

===============
pecl install pdo_pgsql
===============

Then go for a Apache restart. It will be shown up in your phpinfo page……..
:)