dbTalk Databases Forums  

[BUGS] BUG #1748: Unique contraints cannot be added to long text fields

mailing.database.pgsql-bugs mailing.database.pgsql-bugs


Discuss [BUGS] BUG #1748: Unique contraints cannot be added to long text fields in the mailing.database.pgsql-bugs forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Greg Steffensen
 
Posts: n/a

Default [BUGS] BUG #1748: Unique contraints cannot be added to long text fields - 07-02-2005 , 11:47 PM







The following bug has been logged online:

Bug reference: 1748
Logged by: Greg Steffensen
Email address: greg.steffensen (AT) gmail (DOT) com
PostgreSQL version: 8.02
Operating system: Gentoo Linux
Description: Unique contraints cannot be added to long text fields
Details:

I'm storing SVG files, which can be many kilobytes long, in a text field.
When I try to add a unique contraint to that field, or try to add a row to a
table that already has had the unique contraint applied, I get errors like
the following:

ERROR: index row requires 15528 bytes, maximum size is 8191

Evidently, the unique constraint creates an index, but the index can't
handle large field sizes.

---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to majordomo (AT) postgresql (DOT) org so that your
message can get through to the mailing list cleanly

Reply With Quote
  #2  
Old   
Alvaro Herrera
 
Posts: n/a

Default Re: [BUGS] BUG #1748: Unique contraints cannot be added to long text fields - 07-03-2005 , 11:10 AM






On Sat, Jul 02, 2005 at 05:20:29PM +0100, Greg Steffensen wrote:

Quote:
I'm storing SVG files, which can be many kilobytes long, in a text field.
When I try to add a unique contraint to that field, or try to add a row to a
table that already has had the unique contraint applied, I get errors like
the following:

ERROR: index row requires 15528 bytes, maximum size is 8191

Evidently, the unique constraint creates an index, but the index can't
handle large field sizes.
Yes, that's a known limitation -- you cannot store arbitrarily large
fields in an index. Even if it was possible I don't think it'd be a
good idea from an efficiency POV. You may want to create an index in a
digested version of the file instead (SHA-1, say, or MD5).

--
Alvaro Herrera (<alvherre[a]surnet.cl>)
"El conflicto es el camino real hacia la unión"

---------------------------(end of broadcast)---------------------------
TIP 8: explain analyze is your friend


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.