Search Kit: DB Entity needs all columns to work
Overview
When using DB Entity you cannot delete columns, or the results will not be refreshed on the DB table
Reproduction steps
Current behaviour
If you delete some columns in the DB Entity, you can Save the Search but it will not refresh the results in the DB Table.
The Api4 gets you more information about what's happening:
"info": "INSERT INTO `civicrm_sk_contacts_db_entity1` (id, sort_name)
SELECT `a`.`id` AS `id`,
`a`.`sort_name` AS `sort_name`,
`a`.`contact_type` AS `contact_type:label`,
`a`.`contact_sub_type` AS `contact_sub_type:label`
FROM civicrm_contact a
WHERE (`a`.`contact_type` = \"Individual\")
ORDER BY `a`.`sort_name` ASC
[nativecode=1136 ** Column count doesn't match value count at row 1]",
"db_error": "value count on row",
As you can see, the Insert above is not correct and that (I suspect) is the main reason of this behaviour.
Expected behaviour
Can alter the number of columns in the DB Entity, to only save the ones that you want on the DB Table.
Environment information
- CiviCRM: dmaster v.5.67.alpha1