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

Re: unique constraint

From: "ktm(at)rice(dot)edu" <ktm(at)rice(dot)edu>
To: Roberto Caravani <JFanatiker(at)gmx(dot)at>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: unique constraint
Date: 2012-04-17 19:16:02
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-novice
On Tue, Apr 17, 2012 at 07:46:26PM +0200, Roberto Caravani wrote:
> Hi!
> I have a little problem with a unique constraint:
> create table meta_data (
> 	id				serial		primary key,
> 	type			int			not null,
> 	data			bytea		not null,
> 	unique (type, data)
> );
> data can be quite large (a few hundred kilo bytes). The unique constraint automatically creates a btree index as I learned from the documentation. The problem is that I get an error when inserting data, that the index is to large. I would like to keep the unique constraint, is there a way to fix this?
> I googled the problem and found others having similar issues, but I have not found a solution that suited me.
> Thanks in advance!
> Best regards,
> Robert

Hi Robert,

You may need to store a crypographic signature for the data and unique that instead.


In response to

pgsql-novice by date

Next:From: Tom LaneDate: 2012-04-17 19:18:53
Subject: Re: unique constraint
Previous:From: Roberto CaravaniDate: 2012-04-17 17:46:26
Subject: unique constraint

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