[DRE-maint] Bug#1014904: Upgrading from 14.9.x to 14.10.5 produces PGSQL errors on some page views

Patrick Matthäi patrick at linux-dev.org
Thu Jul 14 09:31:13 BST 2022


Package: gitlab
Version: 14.10.5+ds1-1
Severity: serious

Hello,

since I have updated gitlab to 14.10.5+ds1-1 (bullseye system) many 
views are not working, or just working if you are a gitlab administrator.

Changing the locale from de_DE to en_US (also for the postgres database) 
did not work, the error is the same (in english :) ):

ActionView::Template::Error (PG::SyntaxError: ERROR:  each UNION query 
must have the same number of columns
LINE 5: (SELECT "namespaces".* FROM "namespaces" INNER JOIN "group_g...

Here is what I get in the logs if I open the project explorer or a 
customer project:


URL: https://OUR.GITLAB.URL/explore/groups

==> production.log <==
Started GET "/explore/groups" for 20YY:XX:AAA:BBB:18ba:a0fc:111:222 at 
2022-07-14 10:20:31 +0200
Processing by Explore::GroupsController#index as HTML
   Rendered layout layouts/explore.html.haml (Duration: 14.4ms | 
Allocations: 2065)
Completed 500 Internal Server Error in 68ms (ActiveRecord: 8.1ms | 
Elasticsearch: 0.0ms | Allocations: 11651)

==> production_json.log <==
{"method":"GET","path":"/explore/groups","format":"html","controller":"Explore::GroupsController","action":"index","status":500,"time":"2022-07-14T08:20:31.879Z","params":[],"correlation_id":"01G7XWQ4X8R1T0ARMYZCC1CPM0","meta.user":"florian.finke","meta.client_id":"user/27","meta.caller_id":"Explore::GroupsController#index","meta.remote_ip":"20YY:XX:AAA:BBB:18ba:a0fc:111:222","meta.feature_category":"subgroups","remote_ip":"20YY:XX:AAA:BBB:18ba:a0fc:111:222","user_id":27,"username":"florian.finke","ua":"Mozilla/5.0 
(Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 
Firefox/102.0","request_urgency":"default","target_duration_s":1,"redis_calls":10,"redis_duration_s":0.0040880000000000005,"redis_read_bytes":1806,"redis_write_bytes":1740,"redis_cache_calls":8,"redis_cache_duration_s":0.003223,"redis_cache_read_bytes":1623,"redis_cache_write_bytes":475,"redis_shared_state_calls":1,"redis_shared_state_duration_s":0.00034,"redis_shared_state_write_bytes":54,"redis_sessions_calls":1,"redis_sessions_duration_s":0.000525,"redis_sessions_read_bytes":183,"redis_sessions_write_bytes":1211,"db_count":6,"db_write_count":0,"db_cached_count":2,"db_replica_count":0,"db_primary_count":6,"db_main_count":6,"db_main_replica_count":0,"db_replica_cached_count":0,"db_primary_cached_count":2,"db_main_cached_count":2,"db_main_replica_cached_count":0,"db_replica_wal_count":0,"db_primary_wal_count":0,"db_main_wal_count":0,"db_main_replica_wal_count":0,"db_replica_wal_cached_count":0,"db_primary_wal_cached_count":0,"db_main_wal_cached_count":0,"db_main_replica_wal_cached_count":0,"db_replica_duration_s":0.0,"db_primary_duration_s":0.01,"db_main_duration_s":0.01,"db_main_replica_duration_s":0.0,"cpu_s":0.085264,"pid":1930,"exception.class":"ActionView::Template::Error","exception.message":"PG::SyntaxError: 
ERROR:  each UNION query must have the same number of columns\nLINE 5: 
(SELECT \"namespaces\".* FROM \"namespaces\" INNER JOIN \"group_g...\n 
^\n","exception.backtrace":["lib/gitlab/database/load_balancing/connection_proxy.rb:103:in 
`block in 
read_using_load_balancer'","lib/gitlab/database/load_balancing/load_balancer.rb:55:in 
`read'","lib/gitlab/database/load_balancing/connection_proxy.rb:102:in 
`read_using_load_balancer'","lib/gitlab/database/load_balancing/connection_proxy.rb:53:in 
`block (2 levels) in 
<class:ConnectionProxy>'","app/views/explore/groups/index.html.haml:22","app/controllers/application_controller.rb:142:in 
`render'","app/controllers/application_controller.rb:520:in 
`set_current_admin'","lib/gitlab/session.rb:11:in 
`with_session'","app/controllers/application_controller.rb:511:in 
`set_session_storage'","lib/gitlab/i18n.rb:105:in 
`with_locale'","lib/gitlab/i18n.rb:111:in 
`with_user_locale'","app/controllers/application_controller.rb:505:in 
`set_locale'","app/controllers/application_controller.rb:499:in 
`set_current_context'","lib/gitlab/middleware/memory_report.rb:13:in 
`call'","lib/gitlab/middleware/speedscope.rb:13:in 
`call'","lib/gitlab/request_profiler/middleware.rb:17:in 
`call'","lib/gitlab/database/load_balancing/rack_middleware.rb:23:in 
`call'","lib/gitlab/jira/middleware.rb:19:in 
`call'","lib/gitlab/middleware/go.rb:20:in 
`call'","lib/gitlab/etag_caching/middleware.rb:21:in 
`call'","lib/gitlab/middleware/query_analyzer.rb:11:in `block in 
call'","lib/gitlab/database/query_analyzer.rb:46:in 
`within'","lib/gitlab/middleware/query_analyzer.rb:11:in 
`call'","lib/gitlab/middleware/multipart.rb:173:in 
`call'","lib/gitlab/middleware/read_only/controller.rb:50:in 
`call'","lib/gitlab/middleware/read_only.rb:18:in 
`call'","lib/gitlab/middleware/same_site_cookies.rb:27:in 
`call'","lib/gitlab/middleware/handle_malformed_strings.rb:21:in 
`call'","lib/gitlab/middleware/basic_health_check.rb:25:in 
`call'","lib/gitlab/middleware/handle_ip_spoof_attack_error.rb:25:in 
`call'","lib/gitlab/middleware/request_context.rb:21:in 
`call'","lib/gitlab/middleware/webhook_recursion_detection.rb:15:in 
`call'","config/initializers/fix_local_cache_middleware.rb:11:in 
`call'","lib/gitlab/middleware/compressed_json.rb:26:in 
`call'","lib/gitlab/middleware/rack_multipart_tempfile_factory.rb:19:in 
`call'","lib/gitlab/middleware/sidekiq_web_static.rb:20:in 
`call'","lib/gitlab/metrics/requests_rack_middleware.rb:77:in 
`call'","lib/gitlab/middleware/release_env.rb:13:in 
`call'"],"exception.sql":"/*application:web,correlation_id:01G7XWQ4X8R1T0ARMYZCC1CPM0,endpoint_id:Explore::GroupsController#index,db_config_name:main*/ 
SELECT $1 AS one FROM ((WITH RECURSIVE \"base_and_ancestors\" AS ((WITH 
\"direct_groups\" AS MATERIALIZED (SELECT \"namespaces\".* FROM ((SELECT 
\"namespaces\".\"id\", \"namespaces\".\"name\", \"namespaces\".\"path\", 
\"namespaces\".\"owner_id\", \"namespaces\".\"created_at\", 
\"namespaces\".\"updated_at\", \"namespaces\".\"type\", 
\"namespaces\".\"description\", \"namespaces\".\"avatar\", 
\"namespaces\".\"share_with_group_lock\", 
\"namespaces\".\"visibility_level\", 
\"namespaces\".\"request_access_enabled\", 
\"namespaces\".\"description_html\", \"namespaces\".\"lfs_enabled\", 
\"namespaces\".\"parent_id\", 
\"namespaces\".\"require_two_factor_authentication\", 
\"namespaces\".\"two_factor_grace_period\", 
\"namespaces\".\"cached_markdown_version\", 
\"namespaces\".\"runners_token\", 
\"namespaces\".\"project_creation_level\", 
\"namespaces\".\"runners_token_encrypted\", 
\"namespaces\".\"auto_devops_enabled\", 
\"namespaces\".\"custom_project_templates_group_id\", 
\"namespaces\".\"file_template_project_id\", 
\"namespaces\".\"ldap_sync_error\", 
\"namespaces\".\"ldap_sync_last_successful_update_at\", 
\"namespaces\".\"ldap_sync_last_sync_at\", 
\"namespaces\".\"ldap_sync_last_update_at\", 
\"namespaces\".\"repository_size_limit\", 
\"namespaces\".\"saml_discovery_token\", 
\"namespaces\".\"shared_runners_minutes_limit\", 
\"namespaces\".\"extra_shared_runners_minutes_limit\", 
\"namespaces\".\"ldap_sync_status\", \"namespaces\".\"membership_lock\", 
\"namespaces\".\"last_ci_minutes_notification_at\", 
\"namespaces\".\"last_ci_minutes_usage_notification_level\", 
\"namespaces\".\"subgroup_creation_level\", 
\"namespaces\".\"emails_disabled\", \"namespaces\".\"max_pages_size\", 
\"namespaces\".\"max_artifacts_size\", 
\"namespaces\".\"mentions_disabled\", 
\"namespaces\".\"default_branch_protection\", 
\"namespaces\".\"unlock_membership_to_ldap\", 
\"namespaces\".\"max_personal_access_token_lifetime\", 
\"namespaces\".\"push_rule_id\", 
\"namespaces\".\"shared_runners_enabled\", 
\"namespaces\".\"allow_descendants_override_disabled_shared_runners\", 
\"namespaces\".\"traversal_ids\" FROM \"namespaces\" INNER JOIN 
\"members\" ON \"namespaces\".\"id\" = \"members\".\"source_id\" WHERE 
\"members\".\"type\" = $2 AND \"members\".\"source_type\" = $3 AND 
\"namespaces\".\"type\" = $4 AND \"members\".\"user_id\" = $5 AND 
\"members\".\"requested_at\" IS NULL AND (access_level >= 
$6))\nUNION\n(SELECT \"namespaces\".\"id\", \"namespaces\".\"name\", 
\"namespaces\".\"path\", \"namespaces\".\"owner_id\", 
\"namespaces\".\"created_at\", \"namespaces\".\"updated_at\", 
\"namespaces\".\"type\", \"namespaces\".\"description\", 
\"namespaces\".\"avatar\", \"namespaces\".\"share_with_group_lock\", 
\"namespaces\".\"visibility_level\", 
\"namespaces\".\"request_access_enabled\", 
\"namespaces\".\"description_html\", \"namespaces\".\"lfs_enabled\", 
\"namespaces\".\"parent_id\", 
\"namespaces\".\"require_two_factor_authentication\", 
\"namespaces\".\"two_factor_grace_period\", 
\"namespaces\".\"cached_markdown_version\", 
\"namespaces\".\"runners_token\", 
\"namespaces\".\"project_creation_level\", 
\"namespaces\".\"runners_token_encrypted\", 
\"namespaces\".\"auto_devops_enabled\", 
\"namespaces\".\"custom_project_templates_group_id\", 
\"namespaces\".\"file_template_project_id\", 
\"namespaces\".\"ldap_sync_error\", 
\"namespaces\".\"ldap_sync_last_successful_update_at\", 
\"namespaces\".\"ldap_sync_last_sync_at\", 
\"namespaces\".\"ldap_sync_last_update_at\", 
\"namespaces\".\"repository_size_limit\", 
\"namespaces\".\"saml_discovery_token\", 
\"namespaces\".\"shared_runners_minutes_limit\", 
\"namespaces\".\"extra_shared_runners_minutes_limit\", 
\"namespaces\".\"ldap_sync_status\", \"namespaces\".\"membership_lock\", 
\"namespaces\".\"last_ci_minutes_notification_at\", 
\"namespaces\".\"last_ci_minutes_usage_notification_level\", 
\"namespaces\".\"subgroup_creation_level\", 
\"namespaces\".\"emails_disabled\", \"namespaces\".\"max_pages_size\", 
\"namespaces\".\"max_artifacts_size\", 
\"namespaces\".\"mentions_disabled\", 
\"namespaces\".\"default_branch_protection\", 
\"namespaces\".\"unlock_membership_to_ldap\", 
\"namespaces\".\"max_personal_access_token_lifetime\", 
\"namespaces\".\"push_rule_id\", 
\"namespaces\".\"shared_runners_enabled\", 
\"namespaces\".\"allow_descendants_override_disabled_shared_runners\", 
\"namespaces\".\"traversal_ids\" FROM \"projects\" INNER JOIN 
\"project_authorizations\" ON \"projects\".\"id\" = 
\"project_authorizations\".\"project_id\" INNER JOIN \"namespaces\" ON 
\"namespaces\".\"id\" = \"projects\".\"namespace_id\" WHERE 
\"project_authorizations\".\"user_id\" = $7)) namespaces WHERE 
\"namespaces\".\"type\" = $8) SELECT \"namespaces\".* FROM ((SELECT 
\"namespaces\".* FROM \"direct_groups\" \"namespaces\" WHERE 
\"namespaces\".\"type\" = $9)\nUNION\n(SELECT \"namespaces\".* FROM 
\"namespaces\" INNER JOIN \"group_group_links\" ON 
\"group_group_links\".\"shared_group_id\" = \"namespaces\".\"id\" WHERE 
\"namespaces\".\"type\" = $10 AND 
\"group_group_links\".\"shared_with_group_id\" IN (SELECT 
\"namespaces\".\"id\" FROM \"direct_groups\" \"namespaces\" WHERE 
\"namespaces\".\"type\" = $11))) namespaces WHERE 
\"namespaces\".\"type\" = $12)\nUNION\n(SELECT \"namespaces\".* FROM 
\"namespaces\", \"base_and_ancestors\" WHERE \"namespaces\".\"type\" = 
$13 AND \"namespaces\".\"id\" = \"base_and_ancestors\".\"parent_id\")), 
\"base_and_descendants\" AS ((SELECT \"namespaces\".* FROM 
\"namespaces\" INNER JOIN \"members\" ON \"namespaces\".\"id\" = 
\"members\".\"source_id\" WHERE \"members\".\"type\" = $14 AND 
\"members\".\"source_type\" = $15 AND \"namespaces\".\"type\" = $16 AND 
\"members\".\"user_id\" = $17 AND \"members\".\"requested_at\" IS NULL 
AND (access_level >= $18))\nUNION\n(SELECT \"namespaces\".* FROM 
\"namespaces\", \"base_and_descendants\" WHERE \"namespaces\".\"type\" = 
$19 AND \"namespaces\".\"parent_id\" = \"base_and_descendants\".\"id\")) 
SELECT \"namespaces\".* FROM ((SELECT \"namespaces\".* FROM 
\"base_and_ancestors\" AS \"namespaces\" WHERE \"namespaces\".\"type\" = 
$20)\nUNION\n(SELECT \"namespaces\".* FROM \"base_and_descendants\" AS 
\"namespaces\" WHERE \"namespaces\".\"type\" = $21)) namespaces WHERE 
\"namespaces\".\"type\" = $22)\nUNION\n(SELECT \"namespaces\".* FROM 
\"namespaces\" WHERE \"namespaces\".\"type\" = $23 AND 
\"namespaces\".\"visibility_level\" IN ($24, $25))) namespaces WHERE 
\"namespaces\".\"type\" = $26 AND \"namespaces\".\"parent_id\" IS NULL 
LIMIT $27 OFFSET 
$28","db_duration_s":0.00808,"view_duration_s":0.0,"duration_s":0.06849}

==> production.log <==

ActionView::Template::Error (PG::SyntaxError: ERROR:  each UNION query 
must have the same number of columns
LINE 5: (SELECT "namespaces".* FROM "namespaces" INNER JOIN "group_g...
                 ^
):
     19:       %p= _("Below you will find all the groups that are public.")
     20:       %p= _("You can easily contribute to them by requesting to 
join these groups.")
     21:
     22: - if params[:filter].blank? && @groups.empty?
     23:   .nothing-here-block= _("No public groups")
     24: - else
     25:   = render 'groups'

lib/gitlab/database/load_balancing/connection_proxy.rb:103:in `block in 
read_using_load_balancer'
lib/gitlab/database/load_balancing/load_balancer.rb:55:in `read'
lib/gitlab/database/load_balancing/connection_proxy.rb:102:in 
`read_using_load_balancer'
lib/gitlab/database/load_balancing/connection_proxy.rb:53:in `block (2 
levels) in <class:ConnectionProxy>'
app/views/explore/groups/index.html.haml:22
app/controllers/application_controller.rb:142:in `render'
app/controllers/application_controller.rb:520:in `set_current_admin'
lib/gitlab/session.rb:11:in `with_session'
app/controllers/application_controller.rb:511:in `set_session_storage'
lib/gitlab/i18n.rb:105:in `with_locale'
lib/gitlab/i18n.rb:111:in `with_user_locale'
app/controllers/application_controller.rb:505:in `set_locale'
app/controllers/application_controller.rb:499:in `set_current_context'
lib/gitlab/middleware/memory_report.rb:13:in `call'
lib/gitlab/middleware/speedscope.rb:13:in `call'
lib/gitlab/request_profiler/middleware.rb:17:in `call'
lib/gitlab/database/load_balancing/rack_middleware.rb:23:in `call'
lib/gitlab/jira/middleware.rb:19:in `call'
lib/gitlab/middleware/go.rb:20:in `call'
lib/gitlab/etag_caching/middleware.rb:21:in `call'
lib/gitlab/middleware/query_analyzer.rb:11:in `block in call'
lib/gitlab/database/query_analyzer.rb:46:in `within'
lib/gitlab/middleware/query_analyzer.rb:11:in `call'
lib/gitlab/middleware/multipart.rb:173:in `call'
lib/gitlab/middleware/read_only/controller.rb:50:in `call'
lib/gitlab/middleware/read_only.rb:18:in `call'
lib/gitlab/middleware/same_site_cookies.rb:27:in `call'
lib/gitlab/middleware/handle_malformed_strings.rb:21:in `call'
lib/gitlab/middleware/basic_health_check.rb:25:in `call'
lib/gitlab/middleware/handle_ip_spoof_attack_error.rb:25:in `call'
lib/gitlab/middleware/request_context.rb:21:in `call'
lib/gitlab/middleware/webhook_recursion_detection.rb:15:in `call'
config/initializers/fix_local_cache_middleware.rb:11:in `call'
lib/gitlab/middleware/compressed_json.rb:26:in `call'
lib/gitlab/middleware/rack_multipart_tempfile_factory.rb:19:in `call'
lib/gitlab/middleware/sidekiq_web_static.rb:20:in `call'
lib/gitlab/metrics/requests_rack_middleware.rb:77:in `call'
lib/gitlab/middleware/release_env.rb:13:in `call'


URL:
https://OUR.GITLAB.URL/customer/CUSTOMERNAME - here Display Subgroups / 
Projects gives an error, works as administrator:

==> production.log <==
Started GET "/customer/CUSTOMERNAME" for 
20YY:XX:AAA:BBB:18ba:a0fc:111:222 at 2022-07-14 10:21:56 +0200
Processing by GroupsController#show as HTML
   Parameters: {"id"=>"customer/CUSTOMERNAME"}
   Rendered layout layouts/group.html.haml (Duration: 402.0ms | 
Allocations: 85260)
Completed 200 OK in 442ms (Views: 357.9ms | ActiveRecord: 48.0ms | 
Elasticsearch: 0.0ms | Allocations: 91928)

==> production_json.log <==
{"method":"GET","path":"/customer/CUSTOMERNAME","format":"html","controller":"GroupsController","action":"show","status":200,"time":"2022-07-14T08:21:57.337Z","params":[{"key":"id","value":"customer/CUSTOMERNAME"}],"correlation_id":"01G7XWSQZTSH2T6PR3PH7JC9T4","meta.user":"florian.finke","meta.root_namespace":"customer","meta.client_id":"user/27","meta.caller_id":"GroupsController#show","meta.remote_ip":"20YY:XX:AAA:BBB:18ba:a0fc:111:222","meta.feature_category":"subgroups","remote_ip":"20YY:XX:AAA:BBB:18ba:a0fc:111:222","user_id":27,"username":"florian.finke","ua":"Mozilla/5.0 
(Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 
Firefox/102.0","request_urgency":"low","target_duration_s":5,"redis_calls":16,"redis_duration_s":0.00628,"redis_read_bytes":2620,"redis_write_bytes":2191,"redis_cache_calls":14,"redis_cache_duration_s":0.005273,"redis_cache_read_bytes":2437,"redis_cache_write_bytes":926,"redis_shared_state_calls":1,"redis_shared_state_duration_s":0.000374,"redis_shared_state_write_bytes":54,"redis_sessions_calls":1,"redis_sessions_duration_s":0.000633,"redis_sessions_read_bytes":183,"redis_sessions_write_bytes":1211,"db_count":29,"db_write_count":0,"db_cached_count":4,"db_replica_count":0,"db_primary_count":29,"db_main_count":29,"db_main_replica_count":0,"db_replica_cached_count":0,"db_primary_cached_count":4,"db_main_cached_count":4,"db_main_replica_cached_count":0,"db_replica_wal_count":0,"db_primary_wal_count":0,"db_main_wal_count":0,"db_main_replica_wal_count":0,"db_replica_wal_cached_count":0,"db_primary_wal_cached_count":0,"db_main_wal_cached_count":0,"db_main_replica_wal_cached_count":0,"db_replica_duration_s":0.0,"db_primary_duration_s":0.053,"db_main_duration_s":0.053,"db_main_replica_duration_s":0.0,"cpu_s":0.429814,"pid":1930,"db_duration_s":0.04802,"view_duration_s":0.35791,"duration_s":0.44184}

==> production.log <==
Started GET "/groups/customer/CUSTOMERNAME/-/children.json" for 
20YY:XX:AAA:BBB:18ba:a0fc:111:222 at 2022-07-14 10:21:58 +0200
Processing by Groups::ChildrenController#index as JSON
   Parameters: {"group_id"=>"customer/CUSTOMERNAME"}
Completed 500 Internal Server Error in 46ms (ActiveRecord: 3.9ms | 
Elasticsearch: 0.0ms | Allocations: 7686)

==> production_json.log <==
{"method":"GET","path":"/groups/customer/CUSTOMERNAME/-/children.json","format":"json","controller":"Groups::ChildrenController","action":"index","status":500,"time":"2022-07-14T08:21:58.160Z","params":[{"key":"group_id","value":"customer/CUSTOMERNAME"}],"correlation_id":"01G7XWSS61CK8TP1DH5492JA8Z","meta.user":"florian.finke","meta.root_namespace":"customer","meta.client_id":"user/27","meta.caller_id":"Groups::ChildrenController#index","meta.remote_ip":"20YY:XX:AAA:BBB:18ba:a0fc:111:222","meta.feature_category":"subgroups","remote_ip":"20YY:XX:AAA:BBB:18ba:a0fc:111:222","user_id":27,"username":"florian.finke","ua":"Mozilla/5.0 
(Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 
Firefox/102.0","request_urgency":"low","target_duration_s":5,"redis_calls":3,"redis_duration_s":0.001401,"redis_read_bytes":386,"redis_write_bytes":1331,"redis_cache_calls":1,"redis_cache_duration_s":0.000465,"redis_cache_read_bytes":203,"redis_cache_write_bytes":66,"redis_shared_state_calls":1,"redis_shared_state_duration_s":0.000433,"redis_shared_state_write_bytes":54,"redis_sessions_calls":1,"redis_sessions_duration_s":0.000503,"redis_sessions_read_bytes":183,"redis_sessions_write_bytes":1211,"db_count":6,"db_write_count":0,"db_cached_count":1,"db_replica_count":0,"db_primary_count":6,"db_main_count":6,"db_main_replica_count":0,"db_replica_cached_count":0,"db_primary_cached_count":1,"db_main_cached_count":1,"db_main_replica_cached_count":0,"db_replica_wal_count":0,"db_primary_wal_count":0,"db_main_wal_count":0,"db_main_replica_wal_count":0,"db_replica_wal_cached_count":0,"db_primary_wal_cached_count":0,"db_main_wal_cached_count":0,"db_main_replica_wal_cached_count":0,"db_replica_duration_s":0.0,"db_primary_duration_s":0.008,"db_main_duration_s":0.008,"db_main_replica_duration_s":0.0,"cpu_s":0.071358,"pid":1930,"exception.class":"ActiveRecord::StatementInvalid","exception.message":"PG::SyntaxError: 
ERROR:  each UNION query must have the same number of columns\nLINE 5: 
(SELECT \"namespaces\".* FROM \"namespaces\" INNER JOIN \"group_g...\n 
^\n","exception.backtrace":["lib/gitlab/database/load_balancing/connection_proxy.rb:103:in 
`block in 
read_using_load_balancer'","lib/gitlab/database/load_balancing/load_balancer.rb:55:in 
`read'","lib/gitlab/database/load_balancing/connection_proxy.rb:102:in 
`read_using_load_balancer'","lib/gitlab/database/load_balancing/connection_proxy.rb:47:in 
`select_all'","lib/gitlab/multi_collection_paginator.rb:55:in 
`first_collection_page_count'","lib/gitlab/multi_collection_paginator.rb:35:in 
`block in 
paginated_second_collection'","lib/gitlab/multi_collection_paginator.rb:48:in 
`paginated_second_collection'","lib/gitlab/multi_collection_paginator.rb:16:in 
`paginate'","app/finders/group_descendants_finder.rb:54:in 
`children'","app/finders/group_descendants_finder.rb:36:in 
`execute'","app/controllers/groups/children_controller.rb:46:in 
`setup_children'","app/controllers/groups/children_controller.rb:28:in 
`index'","app/controllers/application_controller.rb:520:in 
`set_current_admin'","lib/gitlab/session.rb:11:in 
`with_session'","app/controllers/application_controller.rb:511:in 
`set_session_storage'","lib/gitlab/i18n.rb:105:in 
`with_locale'","lib/gitlab/i18n.rb:111:in 
`with_user_locale'","app/controllers/application_controller.rb:505:in 
`set_locale'","app/controllers/application_controller.rb:499:in 
`set_current_context'","lib/gitlab/middleware/memory_report.rb:13:in 
`call'","lib/gitlab/middleware/speedscope.rb:13:in 
`call'","lib/gitlab/request_profiler/middleware.rb:17:in 
`call'","lib/gitlab/database/load_balancing/rack_middleware.rb:23:in 
`call'","lib/gitlab/jira/middleware.rb:19:in 
`call'","lib/gitlab/middleware/go.rb:20:in 
`call'","lib/gitlab/etag_caching/middleware.rb:21:in 
`call'","lib/gitlab/middleware/query_analyzer.rb:11:in `block in 
call'","lib/gitlab/database/query_analyzer.rb:46:in 
`within'","lib/gitlab/middleware/query_analyzer.rb:11:in 
`call'","lib/gitlab/middleware/multipart.rb:173:in 
`call'","lib/gitlab/middleware/read_only/controller.rb:50:in 
`call'","lib/gitlab/middleware/read_only.rb:18:in 
`call'","lib/gitlab/middleware/same_site_cookies.rb:27:in 
`call'","lib/gitlab/middleware/handle_malformed_strings.rb:21:in 
`call'","lib/gitlab/middleware/basic_health_check.rb:25:in 
`call'","lib/gitlab/middleware/handle_ip_spoof_attack_error.rb:25:in 
`call'","lib/gitlab/middleware/request_context.rb:21:in 
`call'","lib/gitlab/middleware/webhook_recursion_detection.rb:15:in 
`call'","config/initializers/fix_local_cache_middleware.rb:11:in 
`call'","lib/gitlab/middleware/compressed_json.rb:26:in 
`call'","lib/gitlab/middleware/rack_multipart_tempfile_factory.rb:19:in 
`call'","lib/gitlab/middleware/sidekiq_web_static.rb:20:in 
`call'","lib/gitlab/metrics/requests_rack_middleware.rb:77:in 
`call'","lib/gitlab/middleware/release_env.rb:13:in 
`call'"],"exception.sql":"/*application:web,correlation_id:01G7XWSS61CK8TP1DH5492JA8Z,endpoint_id:Groups::ChildrenController#index,db_config_name:main*/ 
SELECT COUNT(*) FROM (SELECT namespaces.*, (SELECT COUNT(*) AS 
preloaded_project_count FROM \"projects\" WHERE 
\"projects\".\"namespace_id\" = \"namespaces\".\"id\" AND 
\"projects\".\"archived\" != $1) AS preloaded_project_count, (SELECT 
COUNT(*) AS preloaded_member_count FROM \"members\" WHERE 
\"members\".\"source_type\" = $2 AND \"members\".\"source_id\" = 
\"namespaces\".\"id\" AND \"members\".\"requested_at\" IS NULL AND 
\"members\".\"access_level\" > $3) AS preloaded_member_count, (SELECT 
COUNT(*) AS preloaded_subgroup_count FROM \"namespaces\" \"children\" 
WHERE \"children\".\"parent_id\" = \"namespaces\".\"id\" AND 
\"children\".\"type\" IS DISTINCT FROM $4) AS preloaded_subgroup_count 
FROM ((WITH RECURSIVE \"base_and_ancestors\" AS ((WITH \"direct_groups\" 
AS MATERIALIZED (SELECT \"namespaces\".* FROM ((SELECT 
\"namespaces\".\"id\", \"namespaces\".\"name\", \"namespaces\".\"path\", 
\"namespaces\".\"owner_id\", \"namespaces\".\"created_at\", 
\"namespaces\".\"updated_at\", \"namespaces\".\"type\", 
\"namespaces\".\"description\", \"namespaces\".\"avatar\", 
\"namespaces\".\"share_with_group_lock\", 
\"namespaces\".\"visibility_level\", 
\"namespaces\".\"request_access_enabled\", 
\"namespaces\".\"description_html\", \"namespaces\".\"lfs_enabled\", 
\"namespaces\".\"parent_id\", 
\"namespaces\".\"require_two_factor_authentication\", 
\"namespaces\".\"two_factor_grace_period\", 
\"namespaces\".\"cached_markdown_version\", 
\"namespaces\".\"runners_token\", 
\"namespaces\".\"project_creation_level\", 
\"namespaces\".\"runners_token_encrypted\", 
\"namespaces\".\"auto_devops_enabled\", 
\"namespaces\".\"custom_project_templates_group_id\", 
\"namespaces\".\"file_template_project_id\", 
\"namespaces\".\"ldap_sync_error\", 
\"namespaces\".\"ldap_sync_last_successful_update_at\", 
\"namespaces\".\"ldap_sync_last_sync_at\", 
\"namespaces\".\"ldap_sync_last_update_at\", 
\"namespaces\".\"repository_size_limit\", 
\"namespaces\".\"saml_discovery_token\", 
\"namespaces\".\"shared_runners_minutes_limit\", 
\"namespaces\".\"extra_shared_runners_minutes_limit\", 
\"namespaces\".\"ldap_sync_status\", \"namespaces\".\"membership_lock\", 
\"namespaces\".\"last_ci_minutes_notification_at\", 
\"namespaces\".\"last_ci_minutes_usage_notification_level\", 
\"namespaces\".\"subgroup_creation_level\", 
\"namespaces\".\"emails_disabled\", \"namespaces\".\"max_pages_size\", 
\"namespaces\".\"max_artifacts_size\", 
\"namespaces\".\"mentions_disabled\", 
\"namespaces\".\"default_branch_protection\", 
\"namespaces\".\"unlock_membership_to_ldap\", 
\"namespaces\".\"max_personal_access_token_lifetime\", 
\"namespaces\".\"push_rule_id\", 
\"namespaces\".\"shared_runners_enabled\", 
\"namespaces\".\"allow_descendants_override_disabled_shared_runners\", 
\"namespaces\".\"traversal_ids\" FROM \"namespaces\" INNER JOIN 
\"members\" ON \"namespaces\".\"id\" = \"members\".\"source_id\" WHERE 
\"members\".\"type\" = $5 AND \"members\".\"source_type\" = $6 AND 
\"namespaces\".\"type\" = $7 AND \"members\".\"user_id\" = $8 AND 
\"members\".\"requested_at\" IS NULL AND (access_level >= 
$9))\nUNION\n(SELECT \"namespaces\".\"id\", \"namespaces\".\"name\", 
\"namespaces\".\"path\", \"namespaces\".\"owner_id\", 
\"namespaces\".\"created_at\", \"namespaces\".\"updated_at\", 
\"namespaces\".\"type\", \"namespaces\".\"description\", 
\"namespaces\".\"avatar\", \"namespaces\".\"share_with_group_lock\", 
\"namespaces\".\"visibility_level\", 
\"namespaces\".\"request_access_enabled\", 
\"namespaces\".\"description_html\", \"namespaces\".\"lfs_enabled\", 
\"namespaces\".\"parent_id\", 
\"namespaces\".\"require_two_factor_authentication\", 
\"namespaces\".\"two_factor_grace_period\", 
\"namespaces\".\"cached_markdown_version\", 
\"namespaces\".\"runners_token\", 
\"namespaces\".\"project_creation_level\", 
\"namespaces\".\"runners_token_encrypted\", 
\"namespaces\".\"auto_devops_enabled\", 
\"namespaces\".\"custom_project_templates_group_id\", 
\"namespaces\".\"file_template_project_id\", 
\"namespaces\".\"ldap_sync_error\", 
\"namespaces\".\"ldap_sync_last_successful_update_at\", 
\"namespaces\".\"ldap_sync_last_sync_at\", 
\"namespaces\".\"ldap_sync_last_update_at\", 
\"namespaces\".\"repository_size_limit\", 
\"namespaces\".\"saml_discovery_token\", 
\"namespaces\".\"shared_runners_minutes_limit\", 
\"namespaces\".\"extra_shared_runners_minutes_limit\", 
\"namespaces\".\"ldap_sync_status\", \"namespaces\".\"membership_lock\", 
\"namespaces\".\"last_ci_minutes_notification_at\", 
\"namespaces\".\"last_ci_minutes_usage_notification_level\", 
\"namespaces\".\"subgroup_creation_level\", 
\"namespaces\".\"emails_disabled\", \"namespaces\".\"max_pages_size\", 
\"namespaces\".\"max_artifacts_size\", 
\"namespaces\".\"mentions_disabled\", 
\"namespaces\".\"default_branch_protection\", 
\"namespaces\".\"unlock_membership_to_ldap\", 
\"namespaces\".\"max_personal_access_token_lifetime\", 
\"namespaces\".\"push_rule_id\", 
\"namespaces\".\"shared_runners_enabled\", 
\"namespaces\".\"allow_descendants_override_disabled_shared_runners\", 
\"namespaces\".\"traversal_ids\" FROM \"projects\" INNER JOIN 
\"project_authorizations\" ON \"projects\".\"id\" = 
\"project_authorizations\".\"project_id\" INNER JOIN \"namespaces\" ON 
\"namespaces\".\"id\" = \"projects\".\"namespace_id\" WHERE 
\"project_authorizations\".\"user_id\" = $10)) namespaces WHERE 
\"namespaces\".\"type\" = $11) SELECT \"namespaces\".* FROM ((SELECT 
\"namespaces\".* FROM \"direct_groups\" \"namespaces\" WHERE 
\"namespaces\".\"type\" = $12)\nUNION\n(SELECT \"namespaces\".* FROM 
\"namespaces\" INNER JOIN \"group_group_links\" ON 
\"group_group_links\".\"shared_group_id\" = \"namespaces\".\"id\" WHERE 
\"namespaces\".\"type\" = $13 AND 
\"group_group_links\".\"shared_with_group_id\" IN (SELECT 
\"namespaces\".\"id\" FROM \"direct_groups\" \"namespaces\" WHERE 
\"namespaces\".\"type\" = $14))) namespaces WHERE 
\"namespaces\".\"type\" = $15)\nUNION\n(SELECT \"namespaces\".* FROM 
\"namespaces\", \"base_and_ancestors\" WHERE \"namespaces\".\"type\" = 
$16 AND \"namespaces\".\"id\" = \"base_and_ancestors\".\"parent_id\")), 
\"base_and_descendants\" AS ((SELECT \"namespaces\".* FROM 
\"namespaces\" INNER JOIN \"members\" ON \"namespaces\".\"id\" = 
\"members\".\"source_id\" WHERE \"members\".\"type\" = $17 AND 
\"members\".\"source_type\" = $18 AND \"namespaces\".\"type\" = $19 AND 
\"members\".\"user_id\" = $20 AND \"members\".\"requested_at\" IS NULL 
AND (access_level >= $21))\nUNION\n(SELECT \"namespaces\".* FROM 
\"namespaces\", \"base_and_descendants\" WHERE \"namespaces\".\"type\" = 
$22 AND \"namespaces\".\"parent_id\" = \"base_and_descendants\".\"id\")) 
SELECT \"namespaces\".* FROM ((SELECT \"namespaces\".* FROM 
\"base_and_ancestors\" AS \"namespaces\" WHERE \"namespaces\".\"type\" = 
$23)\nUNION\n(SELECT \"namespaces\".* FROM \"base_and_descendants\" AS 
\"namespaces\" WHERE \"namespaces\".\"type\" = $24)) namespaces WHERE 
\"namespaces\".\"type\" = $25 AND \"namespaces\".\"parent_id\" = 
$26)\nUNION\n(SELECT \"namespaces\".* FROM \"namespaces\" WHERE 
\"namespaces\".\"type\" = $27 AND \"namespaces\".\"visibility_level\" IN 
($28, $29) AND \"namespaces\".\"parent_id\" = $30)) namespaces WHERE 
\"namespaces\".\"type\" = $31) 
subquery_for_count","db_duration_s":0.00393,"view_duration_s":0.0,"duration_s":0.04619}

==> production.log <==

ActiveRecord::StatementInvalid (PG::SyntaxError: ERROR:  each UNION 
query must have the same number of columns
LINE 5: (SELECT "namespaces".* FROM "namespaces" INNER JOIN "group_g...
                 ^
):

lib/gitlab/database/load_balancing/connection_proxy.rb:103:in `block in 
read_using_load_balancer'
lib/gitlab/database/load_balancing/load_balancer.rb:55:in `read'
lib/gitlab/database/load_balancing/connection_proxy.rb:102:in 
`read_using_load_balancer'
lib/gitlab/database/load_balancing/connection_proxy.rb:47:in `select_all'
lib/gitlab/multi_collection_paginator.rb:55:in `first_collection_page_count'
lib/gitlab/multi_collection_paginator.rb:35:in `block in 
paginated_second_collection'
lib/gitlab/multi_collection_paginator.rb:48:in `paginated_second_collection'
lib/gitlab/multi_collection_paginator.rb:16:in `paginate'
app/finders/group_descendants_finder.rb:54:in `children'
app/finders/group_descendants_finder.rb:36:in `execute'
app/controllers/groups/children_controller.rb:46:in `setup_children'
app/controllers/groups/children_controller.rb:28:in `index'
app/controllers/application_controller.rb:520:in `set_current_admin'
lib/gitlab/session.rb:11:in `with_session'
app/controllers/application_controller.rb:511:in `set_session_storage'
lib/gitlab/i18n.rb:105:in `with_locale'
lib/gitlab/i18n.rb:111:in `with_user_locale'
app/controllers/application_controller.rb:505:in `set_locale'
app/controllers/application_controller.rb:499:in `set_current_context'
lib/gitlab/middleware/memory_report.rb:13:in `call'
lib/gitlab/middleware/speedscope.rb:13:in `call'
lib/gitlab/request_profiler/middleware.rb:17:in `call'
lib/gitlab/database/load_balancing/rack_middleware.rb:23:in `call'
lib/gitlab/jira/middleware.rb:19:in `call'
lib/gitlab/middleware/go.rb:20:in `call'
lib/gitlab/etag_caching/middleware.rb:21:in `call'
lib/gitlab/middleware/query_analyzer.rb:11:in `block in call'
lib/gitlab/database/query_analyzer.rb:46:in `within'
lib/gitlab/middleware/query_analyzer.rb:11:in `call'
lib/gitlab/middleware/multipart.rb:173:in `call'
lib/gitlab/middleware/read_only/controller.rb:50:in `call'
lib/gitlab/middleware/read_only.rb:18:in `call'
lib/gitlab/middleware/same_site_cookies.rb:27:in `call'
lib/gitlab/middleware/handle_malformed_strings.rb:21:in `call'
lib/gitlab/middleware/basic_health_check.rb:25:in `call'
lib/gitlab/middleware/handle_ip_spoof_attack_error.rb:25:in `call'
lib/gitlab/middleware/request_context.rb:21:in `call'
lib/gitlab/middleware/webhook_recursion_detection.rb:15:in `call'
config/initializers/fix_local_cache_middleware.rb:11:in `call'
lib/gitlab/middleware/compressed_json.rb:26:in `call'
lib/gitlab/middleware/rack_multipart_tempfile_factory.rb:19:in `call'
lib/gitlab/middleware/sidekiq_web_static.rb:20:in `call'
lib/gitlab/metrics/requests_rack_middleware.rb:77:in `call'
lib/gitlab/middleware/release_env.rb:13:in `call'
Started POST "/api/v4/jobs/request" for 192.168.224.246 at 2022-07-14 
10:21:58 +0200



More information about the Pkg-ruby-extras-maintainers mailing list