← Back to team overview

drizzle-discuss team mailing list archive

Re: tables must have a primary key


On Wed, Apr 7, 2010 at 2:29 AM, Stewart Smith <stewart@xxxxxxxxxxxxxxxx> wrote:
> So, for Embedded InnoDB, currently I have a requirement that all tables
> must have a primary key.

FWIW, I've never heard a good argument for not having a primary key on
a table. Ever.

> This is due to the Embedded InnoDB API not really allowing us to seek
> based on rowid (which is the primary key in InnoDB when you don't
> explicitly set one) which means that ::position() (or rather ::rnd_pos)
> won't work for such tables... and we don't want to crash out on users
> depending on their table definition :)

That's precisely what I do in replication. ;)  If a table doesn't have
a primary key and replcation is enabled, the statement results in an

> So.. I think this also a limitation for the replication things Jay is
> currently working on.

See above.

> Should we make it a requirement?

I think so.

> Or we can:
> - wait for embedded innodb API to be fixed
> - create our own hidden column that's an auto-inc primary key
>  (similar to what NDB does)

Please, no.



> - live with this limitation for embedded_innodb for the time being and
> hope one of the above two happens.
> --
> Stewart Smith
> _______________________________________________
> Mailing list: https://launchpad.net/~drizzle-discuss
> Post to     : drizzle-discuss@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~drizzle-discuss
> More help   : https://help.launchpad.net/ListHelp

Follow ups