Re: storage engine: how to identify PRIMARY keys?

Sergei Golubchik <[email protected]> Wed, 11 May 2016 11:31:16 +0200
Newsgroups gmane.comp.db.mysql.devel
Message-ID <[email protected]>
Hi, Christoph!

On May 10, Christoph Rupp wrote:
> 
> in the ::create() method of my storage engine I want to create indices
> for all columns where (*field)->m_indexed is true.
> 
> As far as I understand there are different types of indices:
> - PRIMARY: always unique
> - INDEX: usually not unique (can have duplicate keys)
> 
> but I have not been able to figure out whether a FIELD object is a
> primary key or not.

Field object is not *a* primary key, but it can be *a part* of it.

Do you want to know whether a field is a part of a primary key?

  field->part_of_key.is_set(table->s->primary_key)

Regards,
Sergei
Chief Architect MariaDB
and [email protected]

-- 
MySQL Internals Mailing List
For list archives: http://lists.mysql.com/internals
To unsubscribe:    http://lists.mysql.com/internals