Cannot Import Dump From Sqlite To Postgres #2923

Closed
opened 2025-11-02 04:54:15 -06:00 by GiteaMirror · 3 comments
Owner

Originally created by @ccaspers on GitHub (Feb 15, 2019).

  • Gitea version (or commit ref): 3b612ce
  • Git version: 2.18
  • Operating system: Linux (using the official Gitea Docker image)
  • 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:

Description

I tried migrating a Gitea instance from Sqlite to Postgres. [1] and [2] lead me to believe that this is possible now. What I did:

  1. gitea dump -c /path/to/app.ini -d postgres
  2. Copy the generated gitea-db.sql to my Postgres container
  3. psql -U gitea gitea -f gitea-db.sql inside my container

During the import, a lot of errors were logged to stdout. Here is the collected output: stderr.log

I tried with Postgres 10 and 11. The issue seems to be rooted in the generated sql as CREATE TABLE IF NOT EXISTS "user" ( ... "must_change_password" BOOL DEFAULT 0 NOT NULL ...); causes an error in Postgres. Postgres expects 't' or 'f' for boolean values or requires an explicit cast [3].

[1] https://github.com/go-gitea/gitea/issues/5651
[2] https://github.com/go-gitea/gitea/pull/5680
[3] https://stackoverflow.com/questions/7947814/pgerror-error-column-is-required-is-of-type-boolean-but-expression-is-of-typ

Originally created by @ccaspers on GitHub (Feb 15, 2019). <!-- 1. Please speak English, this is the language all of us can speak and write. 2. Please ask questions or configuration/deploy problems on our Discord server (https://discord.gg/NsatcWJ) or forum (https://discourse.gitea.io). 3. Please take a moment to check that your issue doesn't already exist. 4. Please give all relevant information below for bug reports, because incomplete details will be handled as an invalid report. --> - Gitea version (or commit ref): 3b612ce - Git version: 2.18 - Operating system: Linux (using the official Gitea Docker image) - Database (use `[x]`): - [x] PostgreSQL - [ ] MySQL - [ ] MSSQL - [x] SQLite - Can you reproduce the bug at https://try.gitea.io: - [ ] Yes (provide example URL) - [ ] No - [x] Not relevant - Log gist: ## Description I tried migrating a Gitea instance from Sqlite to Postgres. [1] and [2] lead me to believe that this is possible now. What I did: 1. `gitea dump -c /path/to/app.ini -d postgres` 2. Copy the generated `gitea-db.sql` to my Postgres container 3. `psql -U gitea gitea -f gitea-db.sql` inside my container During the import, a lot of errors were logged to stdout. Here is the collected output: [stderr.log](https://github.com/go-gitea/gitea/files/2870209/stderr.log) I tried with Postgres 10 and 11. The issue seems to be rooted in the generated sql as `CREATE TABLE IF NOT EXISTS "user" ( ... "must_change_password" BOOL DEFAULT 0 NOT NULL ...);` causes an error in Postgres. Postgres expects `'t'` or `'f'` for boolean values or requires an explicit cast [3]. Related ---------- [1] https://github.com/go-gitea/gitea/issues/5651 [2] https://github.com/go-gitea/gitea/pull/5680 [3] https://stackoverflow.com/questions/7947814/pgerror-error-column-is-required-is-of-type-boolean-but-expression-is-of-typ
GiteaMirror added the issue/staletype/bug labels 2025-11-02 04:54:15 -06:00
Author
Owner

@lunny commented on GitHub (Mar 27, 2019):

SQLITE store BOOL as INTEGER, so when dump to postgres, it cannot be converted to BOOL because this is only a database to database convert.

@lunny commented on GitHub (Mar 27, 2019): SQLITE store `BOOL` as `INTEGER`, so when dump to postgres, it cannot be converted to `BOOL` because this is only a database to database convert.
Author
Owner

@stale[bot] commented on GitHub (May 26, 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 (May 26, 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.
Author
Owner

@stale[bot] commented on GitHub (Jun 9, 2019):

This issue has been automatically closed because of inactivity. You can re-open it if needed.

@stale[bot] commented on GitHub (Jun 9, 2019): This issue has been automatically closed because of inactivity. You can re-open it if needed.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#2923