Data from the wrong records being displayed

I think I’ve come across a rather serious problem. I have a page which filters records with a single search field. If another search is made, one of the columns updates correctly, while another shows data from the previous search.

I could be doing something silly, but I wouldn’t have thought this should happen in any circumstances. I’ve made a demo showing the problem here.

Looking at the MySQL query log, the query which is executed when the search for ‘aaa’ shown in the demo is made is:

… which is what I would expect and which returns the correct results (but not the results which are displayed).

Hello Tom,
Are your dates for the “aaa” records null?

Yes

That’s why you see the “old” values then.
Just add .default('') to your dates table fields values.

1 Like

Great - thanks. I’ll do that, or set defaults in the database.

I’ve come across similar issues before with sorting, but didn’t realise it could affect displayed data. It would be a good idea if some warning was displayed or popped up, in query builder perhaps, to warn about this. I think you mentioned it was performance related, but it has rather serious potential consequences.

Maybe @patrick can check this and see if it can be somehow improved.

1 Like

Hopefully it won’t affect performance but I think it would be a good idea to do something about. I don’t think I’ll have this problem again now, but inevitably others will.