joomla-cms icon indicating copy to clipboard operation
joomla-cms copied to clipboard

[5.X] Global Checkin scheduler plugin fails on SQL Views

Open HLeithner opened this issue 1 year ago • 4 comments

If you have a component which uses SQL Views for data preparation which is not update able the scheduler task fails.

Steps to reproduce the issue

  1. create a view based on #__content which is not update able (not adding the content id should work)
  2. setup the scheduler task global checkin
  3. checkout an item on #__content
  4. run a test on the global checkin task

Expected result

works

Actual result

fails with the result:

{
    "success": false,
    "message": "The target table jgb3i_jd_2_categories of the UPDATE is not updatable",
    "messages": null,
    "data": null
}

System information (as much as possible)

j5.0.2

Additional comments

jdiction uses view wit xml columns for translating table entries. Manual Global Checkin works as expected.

HLeithner avatar Feb 07 '24 15:02 HLeithner

related issue #41149 ?

brianteeman avatar Feb 23 '24 21:02 brianteeman

i'm unable to reproduce with this view

CREATE VIEW `#__blog` AS SELECT `title` ,`checked_out` ,`checked_out_time` FROM `#__content`

global checkin task runs fine

alikon avatar Feb 25 '24 10:02 alikon

yes because this view is updateable, you need a view which does a bit more (I extract xml and override existing columns)

HLeithner avatar Feb 25 '24 18:02 HLeithner

related issue #41149 ?

no it's a completely different topic

HLeithner avatar Feb 25 '24 18:02 HLeithner

ah ok my bad

so with this view

CREATE VIEW j510_blog AS
 select title, checked_out, checked_out_time from j510_content
 union ALL
Select  'a', null, null 

image

then the task will fail

image

i think we need to exclude from $tables = $db->getTableList(); the non updatable views

i'll check better after work

alikon avatar Feb 26 '24 10:02 alikon

https://github.com/joomla-framework/database/blob/3.x-dev/src/Mysqli/MysqliDriver.php#L630

should only return tables (like the postgres version)

SHOW FULL TABLES WHERE Table_type='BASE TABLE'

should work, (it returns 2 columns but the called loadColumn() returns only the first column so should be fine)

HLeithner avatar Feb 26 '24 10:02 HLeithner

yes indeed

alikon avatar Feb 27 '24 19:02 alikon

thanks for the framework pr https://github.com/joomla-framework/database/pull/297 I think we can close this here

HLeithner avatar Feb 27 '24 21:02 HLeithner