[Cubicweb] unique constraint on unlimited String attribute

Julien Cristau julien at cristau.org
Thu Jun 16 15:03:27 CEST 2016


On Thu, Jun 16, 2016 at 14:25:50 +0200, Sylvain Thénault wrote:

> Hi there,
> 
> a while ago I added a unique constraint on cwuri in cubicweb. I've just
> discovered today that it has been removed by 1ee631aedf2f. So I'm wondering: is

This doesn't seem to be the changeset you're talking about, but rather
its child, 48e54aabcd5544945938092f7cf1d39f71b64fb2.

> it really a bad habit to add UNIQUE on unlimited string? I remember being
> advised to never set size constraint on string on postgres for instance...
> 
Indices on unlimited string columns are not supported by sql server, at
least, and in general it seems questionable from a design and
performance pov to want to search on such a field (except using full
text search).

I guess one option is to have an extra computed column with a (fixed
size) hash of your nvarchar(max) column, and index *that*, but
reconsidering either the index or the lack of size limit might be
better.

Cheers,
Julien



More information about the Cubicweb mailing list