Den 2013-10-13 10:56 skrev Ivan Přenosil såhär: > > > I have a table that contains a varchar and there is a unique constraint > > on that varchar column. > > > > My problem is that I would need the table to allow values that differ > > (only) in trailing whitespace. > ... > > Is there any better way to solve this, than using a unique computed > > index on the expression varcharcol || '.' or something similar? > > Other possibiliy is to define the column with character set OCTETS. > > Or add column containing lenght of field and use both data+length columns > in your constraint. >
Interesting propositions. Why does charset octets work? Because it doesn't define what charcodes are whitespace, making the "trailing whitespace rule" mute? The column is defined by the ECO framework, so although I could probably tweak it to charset octets I think I'll stick with my expression index instead. Adding a length column would be a bit problematic under ECO. I wish the trailing whitespace semantics would never have been made applicable to varchar data. I really don't see the point. In fact, since the varchar type was introduced, I don't see why it would be useful at all - assuming char is used only for fixed-width data (why else use char and not varchar?). Thanks! Kjell -- -------------------------------------- Kjell Rilbe DataDIA AB E-post: [email protected] Telefon: 08-761 06 55 Mobil: 0733-44 24 64
