[mythtv] Database upgrade failure

David Hampton mythtv at love2code.net
Sun Jan 30 15:14:04 UTC 2022


On Sun, 2022-01-30 at 10:01 +0000, John Pilkington wrote:
> On 24/01/2022 17:56, David Hampton via mythtv-dev wrote:
> > On Mon, 2022-01-24 at 17:38 +0000, Gary Buhrmaster wrote:
> > > On Mon, Jan 24, 2022 at 5:22 PM Gary Buhrmaster
> > > <gary.buhrmaster at gmail.com> wrote:
> > > I just noticed another issue.  The sportslisting
> > > table uses a foreign key.  And MYISAM does
> > > not support foreign keys.
> > > 
> > > TTBOMK, the MythTV project as historically
> > > avoided using foreign keys (preferring to
> > > implement the business logic in the code,
> > > and any cleanups, including inconsistencies,
> > > to be in the housekeeping codes) in order
> > > to be database independent.
> > 
> > I think I can just drop the FOREIGN_KEY statement, as the code
> > already
> > contains the following constraint in the select statement(1):
> > 
> >      "INNER JOIN sportsapi api ON sl.api = api.id"
> > 
> > I only have a passing familiarity with sql, so I'd love to hear
> > from
> > anyone with more experience if this is a correct solution.
> > 
> > Thanks.
> > 
> > David
> > 
> > 1) From programs/mythbackend/recordingextender.cpp:1153.
> 
> I just tried again, but no luck:
> {{{
> 2022-01-30 09:53:18.551453 C  mythtv-setup version: HEAD 
> [v32-Pre-fd4b8e3487] www.mythtv.org
> 2022-01-30 09:53:18.551459 C  Qt version: compile: 5.9.7, runtime:
> 5.9.7
> 2022-01-30 09:53:18.562244 I  Scientific Linux 7.9 (Nitrogen)
> (x86_64)
> 
> 
> 2022-01-30 09:54:20.094519 C  Upgrading to MythTV schema version 1371
> 2022-01-30 09:54:20.095828 E  DB Error (Performing MythtTV database 
> upgrade):
> Query was: CREATE TABLE sportsapi (
>                id INT UNSIGNED PRIMARY KEY,
>                provider TINYINT UNSIGNED DEFAULT 0,
>                name VARCHAR(128) NOT NULL,
>                key1 VARCHAR(256) NOT NULL,
>                key2 VARCHAR(256) NOT NULL,
>                UNIQUE(provider,key1,key2)
>                ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
> Error was: Driver error was [2/1071]:
> QMYSQL: Unable to execute query
> Database error was:
> Specified key was too long; max key length is 1000 bytes
> }}}

Hi John,

Can you give the attached patch a try before I commit it?  I've reduced
the size of the two keys, and pared down the index even further by
looking at the statistical lengths of the data. Thanks. 

David

-------------- next part --------------
A non-text attachment was scrubbed...
Name: sportsapi.patch
Type: text/x-patch
Size: 787 bytes
Desc: not available
URL: <http://lists.mythtv.org/pipermail/mythtv-dev/attachments/20220130/3ba49963/attachment.bin>


More information about the mythtv-dev mailing list