[wp-trac] [WordPress Trac] #10905: Do not allow duplicate (post_id, meta_key, meta_value) rows in meta tables

WordPress Trac wp-trac at lists.automattic.com
Fri Jan 1 00:53:13 UTC 2010


#10905: Do not allow duplicate (post_id, meta_key, meta_value) rows in meta tables
--------------------------+-------------------------------------------------
 Reporter:  scribu        |       Owner:  ryan          
     Type:  defect (bug)  |      Status:  new           
 Priority:  normal        |   Milestone:  Future Release
Component:  Database      |     Version:  2.9           
 Severity:  normal        |    Keywords:  needs-patch   
--------------------------+-------------------------------------------------
Changes (by scribu):

  * keywords:  needs-patch reporter-feedback => needs-patch


Comment:

 Replying to [comment:6 hakre]:
 > Replying to [comment:1 scribu]:
 > > When trying to add a UNIQUE index to post_id, meta_key and meta_value
 I get an error:
 > >
 > > {{{
 > > #1170 - BLOB/TEXT column 'meta_value' used in key specification
 without a key length
 > > }}}
 > >
 > Can you please provide the SQL you used to create the key? That would be
 interesting.

 {{{
 ALTER TABLE `wp_postmeta` ADD UNIQUE (
 `post_id` ,
 `meta_key` ,
 `meta_value`
 );
 }}}

 It was generated by phpMyAdmin, so I don't think the SQL is wrong.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/10905#comment:9>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list