Mailing List Archive



Back to the month index Back to the list index

Jens Peter Lindemann (jlindema@TechFak.Uni-Bielefeld.DE)
Fri, 25 Apr 1997 11:56:38 +0200


Message-Id: <9704250956.AA06980@kolibri.techfak.uni-bielefeld.de>
Subject: [mSQL] 2.0B6 Bug: unique index again
Date: Fri, 25 Apr 1997 11:56:38 +0200
From: Jens Peter Lindemann <jlindema@TechFak.Uni-Bielefeld.DE>

Hello,

I found another problem with unique-indices:

Try the following:

 create table test (i int, c char(1))\g
 create unique index idx on test (i)\g
 insert into test values (1, 'a')\g
 insert into test values (0, 'b')\g
 update test set c='b' where i=1\g

 => the last query leads to ERROR: Non unique value for unique index

this happens if you create a unique index on an int-column and you
have one value 0 in this column and you do update someting and do not
SET the value in the indexed column.

The probem lies in the function checkIndex() (src/msql/index.c) which
doesn't check wether fillIndexBuffer() did copy anything to the
buffer. A comment in fillIndexBuffer says this case has to be checked
later:
 /* missing field index field. Trapped later */

Thats the reason why checkIndex checks the unique index always against
value '0' in the described case.

My rough-and-dirty patch to check that this is the problem was to
return 0 or 1 from fillIndexBuffer() depending on success/failure,
which can be checked in checkIndex() --- but this may not be what you
want to do...

    o o Jens Peter Lindemann o
   /\ /\ /\ _____
 _`\-`\-`_ Technische Fakultaet, Fachschaft _'-/'_--| _ |
(_)/--/-(_) Universitaet Bielefeld, 33501 Bielefeld (_)-\(_) +-(_)-+
########### e-Mail: jlindema@TechFak.Uni-Bielefeld.DE ################

msqladmin version says:

Version Details :-

        msqladmin version 2.0 Beta 6
        mSQL server version 2.0 Beta 6
        mSQL protocol version 22
        mSQL connection Localhost via UNIX socket
        Target platform Solaris-2.4-Sparc

Configuration Details :-

        Default config file /vol/dinos/msql.conf
        TCP socket 1114
        UNIX socket /vol/dinos/share/mSQL/msql2.sock
        mSQL user jlindema
        Admin user jlindema
        Install directory /vol/dinos/share/mSQL
        PID file location /vol/dinos/share/mSQL/msql2d.pid

--------------------------------------------------------------------------
To remove yourself from the Mini SQL mailing list send a message containing
"unsubscribe" to "unsubscribe" to msql-list-request@bunyip.com. Send a message containing
"info msql-list" to majordomo@bunyip.com for info on monthly archives of
the list. For more help, mail owner-msql-list@bunyip.com NOT the msql-list!