Migrate database from SQLite to PostgreSQL - table schema error #2181

Open
opened 2025-11-20 07:05:24 -05:00 by saavagebueno · 0 comments
Owner

Originally created by @mapolone on GitHub (Aug 14, 2025).

Describe the problem

I'm following this guide to move from SQLite local database to a managed PostgreSQL (version 16.9), as I'm evaluating the self-hosted version on a Ubuntu 24.04 server instance.

To Reproduce

Run the following command, after creating a backup as described here:

pgloader --type sqlite backup/store.db "postgresql://<PG_USER>:<PG_PASSWORD>@<PG_HOST>:<PG_PORT>/<PG_DB_NAME>"

What I get is:

ERROR Database error 22P02: invalid input syntax for type numeric: "false"

and the following schema output:

QUERY: CREATE TABLE accounts
(
  id                                           text,
  created_by                                   text,
  created_at                                   timestamptz,
  domain                                       text,
  domain_category                              text,
  is_domain_primary_account                    numeric,
  network_identifier                           text,
  network_net                                  text,
  network_dns                                  text,
  network_serial                               bigint,
  dns_settings_disabled_management_groups      text,
  settings_peer_login_expiration_enabled       numeric,
  settings_peer_login_expiration               bigint,
  settings_peer_inactivity_expiration_enabled  numeric,
  settings_peer_inactivity_expiration          bigint,
  settings_regular_users_view_blocked          numeric,
  settings_groups_propagation_enabled          numeric,
  settings_jwt_groups_enabled                  numeric,
  settings_jwt_groups_claim_name               text,
  settings_jwt_allow_groups                    text,
  settings_routing_peer_dns_resolution_enabled numeric,
  settings_dns_domain                          text,
  settings_network_range                       text,
  settings_extra_peer_approval_enabled         numeric,
  settings_extra_integrated_validator          text,
  settings_extra_integrated_validator_groups   text,
  settings_lazy_connection_enabled             numeric default 'false'
);

as it is on the SQLite database.
Not sure why the _enabled fields should contain a numeric value instead of a boolean.

Expected behavior

Table and data migrated successfully.

Are you using NetBird Cloud?

No.

NetBird version

0.54.2

Have you tried these troubleshooting steps?

  • Reviewed client troubleshooting (if applicable)
  • Checked for newer NetBird versions
  • Searched for similar issues on GitHub (including closed ones)
  • Restarted the NetBird client
  • Disabled other VPN software
  • Checked firewall settings
Originally created by @mapolone on GitHub (Aug 14, 2025). **Describe the problem** I'm following [this guide](https://docs.netbird.io/selfhosted/postgres-store) to move from SQLite local database to a managed PostgreSQL (version 16.9), as I'm evaluating the self-hosted version on a Ubuntu 24.04 server instance. **To Reproduce** Run the following command, after creating a backup as [described here](https://docs.netbird.io/selfhosted/selfhosted-guide#backup): ```shell pgloader --type sqlite backup/store.db "postgresql://<PG_USER>:<PG_PASSWORD>@<PG_HOST>:<PG_PORT>/<PG_DB_NAME>" ``` What I get is: ``` ERROR Database error 22P02: invalid input syntax for type numeric: "false" ``` and the following schema output: ``` QUERY: CREATE TABLE accounts ( id text, created_by text, created_at timestamptz, domain text, domain_category text, is_domain_primary_account numeric, network_identifier text, network_net text, network_dns text, network_serial bigint, dns_settings_disabled_management_groups text, settings_peer_login_expiration_enabled numeric, settings_peer_login_expiration bigint, settings_peer_inactivity_expiration_enabled numeric, settings_peer_inactivity_expiration bigint, settings_regular_users_view_blocked numeric, settings_groups_propagation_enabled numeric, settings_jwt_groups_enabled numeric, settings_jwt_groups_claim_name text, settings_jwt_allow_groups text, settings_routing_peer_dns_resolution_enabled numeric, settings_dns_domain text, settings_network_range text, settings_extra_peer_approval_enabled numeric, settings_extra_integrated_validator text, settings_extra_integrated_validator_groups text, settings_lazy_connection_enabled numeric default 'false' ); ``` as it is on the SQLite database. Not sure why the _enabled fields should contain a numeric value instead of a boolean. **Expected behavior** Table and data migrated successfully. **Are you using NetBird Cloud?** No. **NetBird version** 0.54.2 **Have you tried these troubleshooting steps?** - [X] Reviewed [client troubleshooting](https://docs.netbird.io/how-to/troubleshooting-client) (if applicable) - [X] Checked for newer NetBird versions - [X] Searched for similar issues on GitHub (including closed ones) - [X] Restarted the NetBird client - [X] Disabled other VPN software - [X] Checked firewall settings
saavagebueno added the triage-needed label 2025-11-20 07:05:24 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: SVI/netbird#2181