Skip site navigation (1) Skip section navigation (2)

Re: pgsql 'prefix' error

From: Harald Fuchs <hari(dot)fuchs(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: pgsql 'prefix' error
Date: 2009-11-24 17:32:00
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-general
In article <4B0BBC8E(dot)6010803(at)indoakses-online(dot)com>,
Bino Oetomo <bino(at)indoakses-online(dot)com> writes:

> I downloaded pgfoundry's prefix, postgresql-8.3-prefix_1.0.0-1_i386.deb
> I install it using dpkg , and run the prefix.sql

> Create database .. named 'prefbino', and

> CREATE TABLE myrecords (
>  record prefix_range NOT NULL,
>  PRIMARY KEY (record)
> );

> Looks good, next
> I try to create some records, But I got this error :
> -----------------------START------------------
> prefbino=# COPY myrecords (record) FROM stdin;
> Enter data to be copied followed by a newline.
> End with a backslash and a period on a line by itself.
>>> 1
>>> 12
>>> 123
>>> 1234
>>> \.
> ERROR: duplicate key value violates unique constraint "myrecords_pkey"
> CONTEXT: COPY myrecords, line 2: "12"

> -----------------------STOP------------------

> Kindly please give me further enlightment

At least in prefix 1.0.0 unique indexes seem to be broken.  Just drop
the primary key and add a separate index:

CREATE INDEX myrecords_record_ix ON myrecords USING gist (record);

In response to


pgsql-general by date

Next:From: Kevin GrittnerDate: 2009-11-24 17:59:40
Subject: Re: [HACKERS] Updating column on row update
Previous:From: Tom LaneDate: 2009-11-24 17:28:20
Subject: Re: [HACKERS] Updating column on row update

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group