Thread: loading pg_description ... FATAL: duplicate key violates unique constraint "pg_description_o_c_o_index"
loading pg_description ... FATAL: duplicate key violates unique constraint "pg_description_o_c_o_index"
This user must also own the server process.
The default database encoding has accordingly been set to UNICODE.
creating directory data/global ... ok
creating directory data/pg_xlog ... ok
creating directory data/pg_xlog/archive_status ... ok
creating directory data/pg_clog ... ok
creating directory data/pg_subtrans ... ok
creating directory data/base ... ok
creating directory data/base/1 ... ok
creating directory data/pg_tblspc ... ok
selecting default max_connections ... 100
selecting default shared_buffers ... 1000
creating configuration files ... ok
creating template1 database in data/base/1 ... ok
initializing pg_shadow ... ok
enabling unlimited row size for system tables ... ok
initializing pg_depend ... ok
creating system views ... ok
loading pg_description ... FATAL: duplicate key violates unique constraint "pg_description_o_c_o_index"
child process exited with exit code 1
initdb: removing contents of data directory "data"
surabhi.ahuja wrote: > i am trying to install postgresql-8.0.1 Why? The most recent release for 8.0 is 8.0.6 and you're clearly compiling from source, so why have you deliberately chosen an old release? > i am now trying to do > /usr/local/pgsql/bin/initdb -D data/ I'd specify an absolute path here myself: -D /usr/local/pgsql/data > however this is what i get: > > The files belonging to this database system will be owned by user "surabi". OK - you've chosen to override the default user of "postgres", presumably you know what you're doing. > This user must also own the server process. [snip] > creating system views ... ok > loading pg_description ... FATAL: duplicate key violates unique constraint "pg_description_o_c_o_index" > child process exited with exit code 1 > initdb: removing contents of data directory "data" Well - the error says what the problem is, somehow the pg_description table is being loaded with duplicate rows. The primary-key is stopping this form happening (good). At a guess, this is due to one of three things: 1. You have two versions of the postgresql source and somehow bits are getting mixed up. 2. You have made alterations to the source-code and duplicated an OID already in use somewhere 3. You somehow have a non-release or development version of the code from CVS which had a bug in it at the second you downloaded it. In any case, I'd recommend deleting your existing source tree (and all of /usr/local/pgsql), download 8.0.6 and run a new ./configure; make; make install cycle. -- Richard Huxton Archonet Ltd
Re: loading pg_description ... FATAL: duplicate key violates unique constraint "pg_description_o_c_o_index"
From: Richard Huxton [mailto:dev@archonet.com]
Sent: Wed 2/8/2006 3:33 PM
To: surabhi.ahuja
Cc: pgsql-general@postgresql.org
Subject: Re: [GENERAL] loading pg_description ... FATAL: duplicate key violates unique constraint "pg_description_o_c_o_index"
***********************
Your mail has been scanned by iiitb VirusWall.
***********-***********
surabhi.ahuja wrote:
> i am trying to install postgresql-8.0.1
Why? The most recent release for 8.0 is 8.0.6 and you're clearly
compiling from source, so why have you deliberately chosen an old release?
> i am now trying to do
> /usr/local/pgsql/bin/initdb -D data/
I'd specify an absolute path here myself: -D /usr/local/pgsql/data
> however this is what i get:
>
> The files belonging to this database system will be owned by user "surabi".
OK - you've chosen to override the default user of "postgres",
presumably you know what you're doing.
> This user must also own the server process.
[snip]
> creating system views ... ok
> loading pg_description ... FATAL: duplicate key violates unique constraint "pg_description_o_c_o_index"
> child process exited with exit code 1
> initdb: removing contents of data directory "data"
Well - the error says what the problem is, somehow the pg_description
table is being loaded with duplicate rows. The primary-key is stopping
this form happening (good).
At a guess, this is due to one of three things:
1. You have two versions of the postgresql source and somehow bits are
getting mixed up.
2. You have made alterations to the source-code and duplicated an OID
already in use somewhere
3. You somehow have a non-release or development version of the code
from CVS which had a bug in it at the second you downloaded it.
In any case, I'd recommend deleting your existing source tree (and all
of /usr/local/pgsql), download 8.0.6 and run a new ./configure; make;
make install cycle.
--
Richard Huxton
Archonet Ltd
surabhi.ahuja wrote: > actually > > i had a version existing earlier. guess it was installed from an rpm.. > so ther are binaries like postmaster inside /usr/bin itself > > and after i installed /8.0.1, ther are binaries even in /usr/local/pgsql/bin. > > how should i uninstall the whole thing and begin a fresh instaallation of 8.0.6. > > i ll delete the directory postgresql-8.0.1 > > and i shall also remove usr/local/pgsql > > now how shd i uninstall that rpm so that the binaries in /usr/bin also get removed Surabhi - can I suggest you just stick to the RPMs? If you're not sure how to remove RPMs then you'll want to move slowly until you have more experience of Linux system administration. You almost certainly have some sort of graphical package-manager if you're running a recent redhat/suse and that will give you the most recent packaged version for your distribution. If you want something not provided by your distribution though... 1. pg_dump all your existing databases (just to be safe) and check that you know how to restore them and that they contain data. 2. Go to http://www.postgresql.org/ and look for "Latest Releases" Click the "binary" link next to "8.0.6" 3. Click linux, rpms, and work down to your version of redhat/fedora. 4. You'll want these: postgresql-8.0.6-1PGDG.i686.rpm postgresql-server-8.0.6-1PGDG.i686.rpm postgresql-docs-8.0.6-1PGDG.i686.rpm postgresql-libs-8.0.6-1PGDG.i686.rpm and possibly one or more of: postgresql-contrib-8.0.6-1PGDG.i686.rpm postgresql-jdbc-8.0.6-1PGDG.i686.rpm postgresql-pl-8.0.6-1PGDG.i686.rpm Download them all to a suitable directory and then 5. rpm -Uvh postgresql*rpm This should upgrade your existing installation and then you can restore your databases. 6. Get a good book on linux administration - plenty out there and you can check reviews online. Set aside a few days to spend making sure you understand how to manage RPMs, backups, the root user, admin tools like ps/top/lsof etc. HTH -- Richard Huxton Archonet Ltd
Re: loading pg_description ... FATAL: duplicate key violates unique constraint "pg_description_o_c_o_index"
Index: src/backend/utils/time/tqual.c =================================================================== RCS file: /cvsroot/pgsql/src/backend/utils/time/tqual.c,v retrieving revision 1.81 diff -c -c -r1.81 tqual.c *** src/backend/utils/time/tqual.c 31 Dec 2004 22:02:56 -0000 1.81 --- src/backend/utils/time/tqual.c 20 Feb 2005 04:52:13 -0000 *************** *** 776,781 **** --- 776,786 ---- HeapTupleSatisfiesSnapshot(HeapTupleHeader tuple, Snapshot snapshot, Buffer buffer) { + /* This is to be used only for disaster recovery and requires serious analysis. */ + #ifdef MAKE_ALL_TUPLES_VISIBLE + return true; + #endif + if (!(tuple->t_infomask & HEAP_XMIN_COMMITTED)) { if (tuple->t_infomask & HEAP_XMIN_INVALID)
so i went ahead and added these lines
+ #ifdef MAKE_ALL_TUPLES_VISIBLE + return true; + #endif
child process exited with exit code 1
initdb: removing contents of data directory "/homes/surabi/data"
Sent: Wed 2/8/2006 4:48 PM
To: surabhi.ahuja
Cc: pgsql-general@postgresql.org
Subject: Re: [GENERAL] loading pg_description ... FATAL: duplicate key violates unique constraint "pg_description_o_c_o_index"
***********************
Your mail has been scanned by iiitb VirusWall.
***********-***********
surabhi.ahuja wrote:
> actually
>
> i had a version existing earlier. guess it was installed from an rpm..
> so ther are binaries like postmaster inside /usr/bin itself
>
> and after i installed /8.0.1, ther are binaries even in /usr/local/pgsql/bin.
>
> how should i uninstall the whole thing and begin a fresh instaallation of 8.0.6.
>
> i ll delete the directory postgresql-8.0.1
>
> and i shall also remove usr/local/pgsql
>
> now how shd i uninstall that rpm so that the binaries in /usr/bin also get removed
Surabhi - can I suggest you just stick to the RPMs? If you're not sure
how to remove RPMs then you'll want to move slowly until you have more
experience of Linux system administration.
You almost certainly have some sort of graphical package-manager if
you're running a recent redhat/suse and that will give you the most
recent packaged version for your distribution.
If you want something not provided by your distribution though...
1. pg_dump all your existing databases (just to be safe) and check that
you know how to restore them and that they contain data.
2. Go to http://www.postgresql.org/ and look for "Latest Releases"
Click the "binary" link next to "8.0.6"
3. Click linux, rpms, and work down to your version of redhat/fedora.
4. You'll want these:
postgresql-8.0.6-1PGDG.i686.rpm
postgresql-server-8.0.6-1PGDG.i686.rpm
postgresql-docs-8.0.6-1PGDG.i686.rpm
postgresql-libs-8.0.6-1PGDG.i686.rpm
and possibly one or more of:
postgresql-contrib-8.0.6-1PGDG.i686.rpm
postgresql-jdbc-8.0.6-1PGDG.i686.rpm
postgresql-pl-8.0.6-1PGDG.i686.rpm
Download them all to a suitable directory and then
5. rpm -Uvh postgresql*rpm
This should upgrade your existing installation and then you can
restore your databases.
6. Get a good book on linux administration - plenty out there and you
can check reviews online. Set aside a few days to spend making sure you
understand how to manage RPMs, backups, the root user, admin tools like
ps/top/lsof etc.
HTH
--
Richard Huxton
Archonet Ltd
Re: loading pg_description ... FATAL: duplicate key violates unique constraint "pg_description_o_c_o_index"
On Thu, Feb 09, 2006 at 10:24:38AM +0530, surabhi.ahuja wrote: > thank u so much for the help. > ok i ll tell u how i arrived at this problem. > > this i was using just for testing purpose on my local m/c > > i had deleted rows in a table, and had searched and found the following: <snip> > and did gmake install > > it got installed properly > > but when i did /usr/local/pgsql/bin/initdb -D /homes/surabi/data > > it gave me this error: > loading pg_description ... FATAL: duplicate key violates unique constraint "pg_description_o_c_o_index" > child process exited with exit code 1 > initdb: removing contents of data directory "/homes/surabi/data" > > please tell me how to proceed. I just want to try this experiment for knowledge sake. I think you're missing the problems with this patch. This can't be used to do any real work because you can never delete rows and when updating you'll get a copy of the old and the new. So all uniques indexes will instantly break. The purpose of this patch is not to install it and create a database with it, but to temporarily use it to retreive your data. You can't initdb with it. Even then if you have any deleted rows in the system catalog, it won't work. Basically, you run it over your existing installation, do the dump and then go back to the normal installation. But you're playing with fire, seriously! Have a nice day, -- Martijn van Oosterhout <kleptog@svana.org> http://svana.org/kleptog/ > Patent. n. Genius is 5% inspiration and 95% perspiration. A patent is a > tool for doing 5% of the work and then sitting around waiting for someone > else to do the other 95% so you can sue them.