MySQL Lists are EOL. Please join:

List:General Discussion« Previous MessageNext Message »
From:Robert D. Lang CEO Date:March 23 1999 10:03pm
Subject:Problem Solved Re: Duplicate Keys.
View as plain text  
Exactly Thimble! One primary key over two fields. But no problem. As I already
wrote to Christian, the problem stemmed from a perl script we are using to input
data into the database ; not stating the host field with the primary key attribute.
I changed this and it now works fine. Thanks to all.

Sometimes I don't know who to contact, perl programmers or mysql programmers on
problems. This error message kept stating a sql can't write error. It was the
script not being able to input data. The mysql program was working fine.

Thimble Smith wrote:

> Christian, I think he's not talking about the mysql.user table.
> I think he's got a his_db.user table that has 'host' and 'user'
> fields in it.
> Robert, it would be very helpful in the future if you can be more
> exact when specifying problems.  It's not possible to have two
> primary keys in one table - you can have only one primary key.
> I assume you mean a primary key over two fields, e.g.:
>     PRIMARY KEY (host, user)
> If you need to remove a row, just use DELETE:
>     DELETE FROM user WHERE host='some host' AND user='some user'
> BUT, if you need to do this regularly then it's quite clear that
> your database design is very far from correct, or else your
> program is doing a lot of work that is not necessary.
> If neither Christian's answer nor mine is sufficient to get you
> past your current dilemma, please do write the list again with
> a better description of what's going on.  I realize that some of
> the terminology can be hard to get a grasp on - when in doubt,
> cut and paste commands (and their output) that show exactly what
> you're struggling with.  That avoids terminology altogether, it
> can be readily duplicated by anyone, etc.
> Tim
> On Tue, Mar 23, 1999 at 09:13:34PM +0100, Christian Mack wrote:
> >"Robert D. Lang CEO" wrote:
> >>Dear Mysql Users:  I have two primary keys in a mysql table
> >>called, " user." They are for host and user fields. I am having
> >>a conflict with regards to updating due to this. I need to
> >>remove one of the primary keys so I do not have a conflict when
> >>writing to the database mysql.
> >>
> >>The error message is: mysql::st execute failed: Can't write,
> >>duplicate key in table 'user.
> >>
> >>I am new to mysql, so I am asking what is the command line needed to remove
> a
> >>primary key from a field?
> >
> >Sorry, but this seems nonsens to me.
> >Why do you want to use one 'user name' with the same 'from host'
> >several times?

Sincerely, Robert D. Lang
RDL Communications Inc.
Speak To Us: rdlcom@stripped   See Us:

Duplicate Keys.Robert D. Lang CEO23 Mar
  • Re: Duplicate Keys.Christian Mack23 Mar
    • Re: Duplicate Keys.Thimble Smith23 Mar
  • Problem Solved Re: Duplicate Keys.Robert D. Lang CEO24 Mar