General solution for detecting mismatched UNION queries with stale cached_column_list
An incident, 2022-01-18: autcomplete_sources returning 500 (gitlab-com/gl-infra/production#6182 - closed), was raised due to 500 being returned from autcomplete_sources
, as well as other methods, generating
PG::SyntaxError: ERROR: each UNION query must have the same number of columns
LINE 5: (SELECT "members".* FROM "members" LEFT OUTER JOIN "users" O...
This was determined to be because of a column, member_namespace_id
, which was added to the members
table.
As the change was rolled out, the cached_column_list
list used by the UNION queries were failing on nodes that had not been updated yet. Re-cylcing the pods fixed the issue.
This specific instance was fixed in !80421 (merged). However we need to make verify_select_values!
detect these particular mismatched UNIONS.
Edited by Brett Walker