Problem/Motivation

I can't get the tests added by #2647470: Write tests to pass on sqlite. postgres and mysql work fine. Debugging has lead me to realise that the way SQLBase::mapjoinable() works doesn't really do it for sqlite. Whilst SQLite can attach any database to each other it is not as simple as the assumptions made in SQLBase::mapjoinable(). These assumptions are that if the database settings have the same host, username, password and port settings that you can query the source and destination databases in the same query. SQLite databases don't actually have any of these settings. They only have the database setting (which points to a file) and the prefix. If SQLite databases have the same file but different prefixes then they can be joined by the existing database code - if not they can't.

We've had a similar issue before #2343213: SQLBase::mapjoinable does not support SQLite - but #2647470: Write tests is the first issue testing the migrate UI.

Proposed resolution

Only allow SQLBase::mapjoinable() for sqlite databases when the database value is the same.

Remaining tasks

None

User interface changes

None

API changes

None

Data model changes

None

CommentFileSizeAuthor
#2 2675000-2.patch2.86 KBalexpott

Comments

alexpott created an issue. See original summary.

alexpott’s picture

Issue summary: View changes
Status: Active » Needs review
Parent issue: #2343213: SQLBase::mapjoinable does not support SQLite »
Related issues: +#2343213: SQLBase::mapjoinable does not support SQLite, +#2647470: Write tests
StatusFileSize
new2.86 KB
alexpott’s picture

Priority: Normal » Major
Issue tags: +Migrate critical

This is blocking the addition of tests in #2647470: Write tests which will block the migrate UI in core... so this is a migrate critical.

gábor hojtsy’s picture

Status: Needs review » Reviewed & tested by the community

Well, as per https://www.sqlite.org/lang_attach.html, ATTACH/DETACH works to add another database (to make them joinable). That sounds like is a bigger problem to solve though and I understand we should make the code properly test against what it currently supports. The fixes are very straightforward based on existing logic in mapJoinable() and #2343213: SQLBase::mapjoinable does not support SQLite. Also the added test coverage of cross-database joinability is good.

alexpott’s picture

Issue summary: View changes
catch’s picture

This looks fine. Just committed to 8.1.x for now, so leaving RTBC against 8.0.x for a cherry-pick later on.

  • catch committed 72d53b3 on 8.1.x
    Issue #2675000 by alexpott: SQLBase::mapjoinable does not support SQLite...
catch’s picture

Status: Reviewed & tested by the community » Fixed

  • catch committed caff451 on 8.0.x
    Issue #2675000 by alexpott: SQLBase::mapjoinable does not support SQLite...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.