Much like the other issues related to running an audit and getting a fatal error on an unknown column, this time related to the 'heading field' module.

CommentFileSizeAuthor
#3 site_audit-heading_field-3316625-2.patch1.15 KBtanc

Issue fork site_audit-3316625

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

tanc created an issue. See original summary.

tanc’s picture

Status: Active » Needs review
StatusFileSize
new1.15 KB

Patch also added as duplicate of the merge request

the_g_bomb’s picture

Status: Needs review » Reviewed & tested by the community

I have applied this patch as a part of a patch cocktail to get site_audit working locally.

I can confirm this patch resolves the issue we were experiencing.

### Environment:
- Drupal 10.4.8
- Site Audit: 4.0.x-dev
- Heading field module installed

### Error Before Patch:

[error] Drupal\Core\Database\DatabaseExceptionWrapper: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'paragraph__field_heading.field_heading_value' in 'where clause'

### After Applying Patch:
The error is resolved. The patch correctly handles the custom column structure of the heading field type (`field_heading_text` instead of `field_heading_value`).

The site_audit command now runs without database errors when scanning paragraphs with heading fields.

froboy made their first commit to this issue’s fork.

froboy’s picture

Version: 8.x-3.x-dev » 4.x-dev
Status: Reviewed & tested by the community » Needs review

@the_g_bomb I'd rather not add module-specific fixes here, especially for relatively small modules (Heading reports <3000 sites). I generated this more generalized fix. I don't totally understand it all yet, but on testing, it was able to resolve all of the db errors with the Heading module installed.

Could you please review https://git.drupalcode.org/project/site_audit/-/merge_requests/23 and let me know if it seems reasonable?

Thanks.

the_g_bomb’s picture

Status: Needs review » Reviewed & tested by the community

I have applied the new patch from MR23

Thanks to the closing of all the tickets recently, I no longer need a patch cocktail to get site_audit working locally.

I can confirm this patch resolves the issue we were experiencing.

### Environment:
- Drupal 10.5.8
- Site Audit: 4.1.2 (strangely the dev release has not updated)
- Heading field module installed

### Error Before Patch:

Drupal\Core\Database\DatabaseExceptionWrapper: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'paragraph__field_heading.field_heading_value' in 'WHERE': SELECT COUNT(*) AS "expression" FROM (SELECT 1 AS "expression" FROM "paragraphs_item" "base_table" INNER JOIN "paragraphs_item_field_data" "paragraphs_item_field_data" ON "paragraphs_item_field_data"."id" = "base_table"."id" INNER JOIN "paragraph__field_heading" "paragraph__field_heading" ON "paragraph__field_heading"."entity_id" = "base_table"."id" WHERE ("paragraphs_item_field_data"."type" = :db_condition_placeholder_0) AND ("paragraph__field_heading"."field_heading_value" IS NOT NULL) GROUP BY "base_table"."revision_id", "base_table"."id") "subquery"; Array ( [:db_condition_placeholder_0] => heading ) in Drupal\Core\Entity\Query\Sql\Query->result() (line 283 of /var/www/html/web/core/lib/Drupal/Core/Entity/Query/Sql/Query.php).

### After Applying Patch:
The error is resolved. The patch correctly handles the custom column structure of the heading field type (`field_heading_text` instead of `field_heading_value`).

The site_audit command now runs without database errors when scanning paragraphs with heading fields and there are no new error messages in the log file.

Thank you.

I much prefer the generic fix rather than the module specific one.

the_g_bomb’s picture

FYI, I was also able to remove a custom patch I had created for a custom field that was causing a similar "unknown column" error.

  • froboy committed e96c0f6a on 4.x
    [#3316625] Add general fix to resolve fatal unknown column errors
    
froboy’s picture

Version: 4.x-dev » 4.1.3
Status: Reviewed & tested by the community » Fixed

@the_g_bomb thanks so much for your breadcrumbs of patches and your review!

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

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