subgroups can not be created because of namespace conflicts
<!--- Please read this! Before opening a new issue, make sure to search for keywords in the issues filtered by the "regression" or "bug" label. For the Community Edition issue tracker: - https://gitlab.com/gitlab-org/gitlab-ce/issues?label_name%5B%5D=regression - https://gitlab.com/gitlab-org/gitlab-ce/issues?label_name%5B%5D=bug For the Enterprise Edition issue tracker: - https://gitlab.com/gitlab-org/gitlab-ee/issues?label_name%5B%5D=regression - https://gitlab.com/gitlab-org/gitlab-ee/issues?label_name%5B%5D=bug and verify the issue you're about to submit isn't a duplicate. ---> ### Summary It is not possible to create a subgroup with the name `001` at our installation. From the logfiles I gather that it validates against a uniqueness and we have indeed a `001` subgroup but in a different namespace/group, the new name would be unique. ### Steps to reproduce ``` curl -H 'PRIVATE-TOKEN: xxx' -d '{"name": "Test Project", "path": "001", "visibility_level": "private", "parent_id": xxx, "description": "Test"}' -H "Content-Type: application/json" -X POST …/api/v4/groups ``` This results in: ``` {"message":"500 Internal Server Error"} ``` The log shows: ``` ActiveRecord::RecordNotUnique (PG::UniqueViolation: ERROR: duplicate key value violates unique constraint "namespaces_path" DETAIL: Key (path)=(001) already exists. : INSERT INTO "namespaces" ("type", "name", "path", "visibility_level", "parent_id", "created_at", "updated_at", "description_html", "cached_markdown_version") VALUES ('Group', 'Test', '001', 0, 420, '2018-11-26 12:45:52.619928', '2018-11-26 12:45:52.619928', '', 11) RETURNING "id"): config/initializers/active_record_locking.rb:11:in `_create_record' app/services/groups/create_service.rb:32:in `execute' ee/app/services/ee/groups/create_service.rb:8:in `execute' app/controllers/groups_controller.rb:40:in `create' lib/gitlab/i18n.rb:55:in `with_locale' lib/gitlab/i18n.rb:61:in `with_user_locale' app/controllers/application_controller.rb:434:in `set_locale' lib/gitlab/middleware/multipart.rb:101:in `call' lib/gitlab/request_profiler/middleware.rb:14:in `call' ee/lib/gitlab/jira/middleware.rb:15:in `call' lib/gitlab/middleware/go.rb:17:in `call' lib/gitlab/etag_caching/middleware.rb:11:in `call' lib/gitlab/middleware/read_only/controller.rb:40:in `call' lib/gitlab/middleware/read_only.rb:16:in `call' lib/gitlab/middleware/basic_health_check.rb:25:in `call' lib/gitlab/request_context.rb:20:in `call' lib/gitlab/metrics/requests_rack_middleware.rb:27:in `call' lib/gitlab/middleware/release_env.rb:10:in `call' ``` ### What is the current *bug* behavior? API shows: ``` {"message":"500 Internal Server Error"} ``` ### What is the expected *correct* behavior? Subgroup `001` is created #### Results of GitLab environment info <details> <summary>Expand for output related to GitLab environment info</summary> <pre> System information System: Ubuntu 16.04 Proxy: no Current User: git Using RVM: no Ruby Version: 2.4.5p335 Gem Version: 2.7.6 Bundler Version:1.16.6 Rake Version: 12.3.1 Redis Version: 3.2.12 Git Version: 2.18.1 Sidekiq Version:5.2.1 Go Version: unknown GitLab information Version: 11.5.0-ee Revision: cb71fca Directory: /opt/gitlab/embedded/service/gitlab-rails DB Adapter: postgresql DB Version: 9.6.6 URL: https://hpm.agency HTTP Clone URL: https://hpm.agency/some-group/some-project.git SSH Clone URL: git@hpm.agency:some-group/some-project.git Elasticsearch: no Geo: yes Geo node: Primary Using LDAP: no Using Omniauth: yes Omniauth Providers: google_oauth2 GitLab Shell Version: 8.4.1 Repository storage paths: - default: /gitlab-data/git-data/repositories Hooks: /opt/gitlab/embedded/service/gitlab-shell/hooks Git: /opt/gitlab/embedded/bin/git </pre> </details> #### Results of GitLab application Check <details> <summary>Expand for output related to the GitLab application check</summary> <pre> </pre> </details> ### Possible fixes
issue