On Jun 9, 2010, at 9:16 AM, Thomas D. wrote:

Zend_Db_Table's method info('primary') will return an array containing all
the primary keys.
I would expect, that the first key should have the offset 0, but the
returned array starts with offset 1.

Is there any reason why the array starts with index 1?

To make the index values compatible with the ordinal position values in INFORMATION_SCHEMA:

create table test.foo (i int, j int, primary key (i, j));

select table_name, constraint_name, column_name, ordinal_position
from information_schema.key_column_usage
where table_schema = 'test' and table_name = 'foo';

+------------+-----------------+-------------+------------------+
| table_name | constraint_name | column_name | ordinal_position |
+------------+-----------------+-------------+------------------+
| foo        | PRIMARY         | i           |                1 |
| foo        | PRIMARY         | j           |                2 |
+------------+-----------------+-------------+------------------+

Regards,
Bill Karwin

Reply via email to