[mythtv-users] Failed database update 1327->1328

Russell Gower mythtv at thegowers.me.uk
Mon Jun 23 10:08:06 UTC 2014


On 23 Jun 2014, at 10:50, Stephen Worthington <stephen_agent at jsw.gen.nz> wrote:

> On Mon, 23 Jun 2014 21:39:52 +1200, you wrote:
> 
>> On Mon, 23 Jun 2014 17:56:22 +1000, you wrote:
>> 
>>> Gary Buhrmaster wrote:
>>>> Those that want to do check to see if they are going to
>>>> have issues can try to run a sql query of the form (only
>>>> written, never actually run/tested, and not really efficient):
>>>>  select * from record as p1 where (select count(*) from record as
>>>> p2
>>>>    where p1.chanid = p2.chanid and p1.starttime = p2.starttime and
>>>>    p1.startdate = p2.startdate and p1.title = p2.title and p1.type
>>>> =
>>>> p2.type) > 1;
>>> 
>>> Probably academic, but likely more efficient, and a useful lesson
>>> for anyone interested in SQL:
>>> 
>>> SELECT chanid, starttime, startdate, title, COUNT(*)
>>> FROM record
>>> GROUP BY chanid, starttime, startdate, title
>>> HAVING COUNT(*) > 1
>>> ORDER BY 1, 2, 3, 4;
>>> 
>>> 
>>> For the record, my database returned zero rows!
>> 
>> That query gives me 10 rows each with count = 2.  So there must have
>> been a problem in the past that has allowed duplicate rows to be
>> created.  I think this will need to be fixed for smooth upgrading to
>> 0.28 when it is released.
> 
> One of the "duplicate" rows was for a very recent recording rule, so I
> checked the full output for those two rows, and it looks like they are
> both valid.  One is the main recording rule, and the other looks to be
> an override rule to not record at one specific time, which just
> happens to be the same time as the main recording rule:
> 
That second query is missing the type field, which is part of the new key, if you include that those two rules will be excluded from the list.

Regards
  Russell



More information about the mythtv-users mailing list