Indices trying to be created second time #1175

Closed
opened 2025-11-02 03:51:26 -06:00 by GiteaMirror · 3 comments
Owner

Originally created by @petrstupka on GitHub (Oct 21, 2017).

  • Gitea version (or commit ref): 1.2.1-linux-amd64
  • Git version: 2.8.4
  • Operating system: Centos 7 (7.4.1708)
  • Database (use [x]):
    • PostgreSQL
    • MySQL
    • MSSQL
    • SQLite
  • Can you reproduce the bug at https://try.gitea.io:
    • Yes (provide example URL)
    • No
    • Not relevant
  • Log gist: gitea.log

Description

Database setup:

  • Postgresql database (version 9.6)
  • database instance appsdb
  • user gitea, created schema gitea
  • SEARCH_PATH set to '$user' for gitea user (no public in SEARCH_PATH) with command ALTER ROLE gitea SET search_path TO "$user";

Problem 1: After filling install form, tables were created, but instalation fails with log message

[...itea/routers/init.go:56 GlobalInit()] [E] Failed to initialize ORM engine: sync database struct error: pq: > relation "UQE_user_lower_name" already exists

When I manually deleted all database tables, gitea started without problem (tables were recreated). I had to manually add user (gitea admin create-user) and then I was able to login.

Problem 2: After steps from section above, I've stopped gitea. The, attemt to start gitea web again failed with the same error as during instalation ('... relation "UQE_user_lower_name" already exists...').
I've tried to drop index, but the same problem occured with another index. After several iterations I've dropped all indices (except primary keys); then gitea web started and recreated all deleted indices.

However, to drop all indices before each start is not usable.

Possibly relevant info

I've found several links which seems to provide some relevant information:

Originally created by @petrstupka on GitHub (Oct 21, 2017). - Gitea version (or commit ref): `1.2.1-linux-amd64` - Git version: `2.8.4` - Operating system: `Centos 7 (7.4.1708)` - Database (use `[x]`): - [x] PostgreSQL - [ ] MySQL - [ ] MSSQL - [ ] SQLite - Can you reproduce the bug at https://try.gitea.io: - [ ] Yes (provide example URL) - [ ] No - [x] Not relevant - Log gist: [gitea.log](https://github.com/go-gitea/gitea/files/1404111/gitea.log) ## Description **Database setup**: - Postgresql database (version 9.6) - database instance `appsdb` - user `gitea`, created schema `gitea` - `SEARCH_PATH` set to `'$user'` for `gitea` user (no public in `SEARCH_PATH`) with command `ALTER ROLE gitea SET search_path TO "$user";` Problem 1: After filling install form, tables were created, but instalation fails with log message > [...itea/routers/init.go:56 GlobalInit()] [E] Failed to initialize ORM engine: sync database struct error: pq: > relation "UQE_user_lower_name" already exists When I manually deleted all database tables, `gitea` started without problem (tables were recreated). I had to manually add user (`gitea admin create-user`) and then I was able to login. Problem 2: After steps from section above, I've stopped `gitea`. The, attemt to start `gitea web` again failed with the same error as during instalation (`'... relation "UQE_user_lower_name" already exists...'`). I've tried to drop index, but the same problem occured with another index. After several iterations I've dropped all indices (except primary keys); then `gitea web` started and recreated all deleted indices. However, to drop all indices before each start is not usable. ### Possibly relevant info I've found several links which seems to provide some relevant information: - https://github.com/gogits/gogs/issues/3359 - https://github.com/go-xorm/xorm/issues/436 - https://github.com/go-xorm/xorm/issues/361 - https://github.com/go-xorm/xorm/issues/379
GiteaMirror added the issue/confirmedtype/bug labels 2025-11-02 03:51:26 -06:00
Author
Owner

@lafriks commented on GitHub (Oct 21, 2017):

@lunny can you look at this, seems xorm related issue

@lafriks commented on GitHub (Oct 21, 2017): @lunny can you look at this, seems xorm related issue
Author
Owner

@lunny commented on GitHub (Oct 21, 2017):

Currently xorm only support public schema.

@lunny commented on GitHub (Oct 21, 2017): Currently xorm only support `public` schema.
Author
Owner

@stale[bot] commented on GitHub (Jan 29, 2019):

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs during the next 2 weeks. Thank you for your contributions.

@stale[bot] commented on GitHub (Jan 29, 2019): This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs during the next 2 weeks. Thank you for your contributions.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#1175