Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7176345
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T16:29:17+00:00 2026-05-28T16:29:17+00:00

I have many tables in Sqlite3 db and now I want to export it

  • 0

I have many tables in Sqlite3 db and now I want to export it to PostgreSQL, but all the time I get errors.
I’ve used different techniques to dump from sqlite:

.mode csv

.header on

.out ddd.sql

select * from my_table

and

.mode insert

.out ddd.sql

select * from my_table

And when I try to import it through phppgadmin I get errors like this:

ERROR: column "1" of relation "my_table" does not exist

LINE 1: INSERT INTO "public"."my_table" ("1", "1", "Vitas", "a@i.ua", "..

How to avoid this error?

Thanks in advance!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T16:29:18+00:00Added an answer on May 28, 2026 at 4:29 pm

    Rant

    You get this “column … does not exist” error with INSERT INTO "public"."my_table" ("1", ... – because quotes around the “1” mean this is an identifier, not literal.

    Even if you fix this, the query still will give error, because of missing VAULES keyword, as Jan noticed in other answer.

    The correct form would be:

    INSERT INTO "public"."my_table" VALUES ('1', ...
    

    If this SQL was autogenerated by sqlite, bad for sqlite.

    This great chapter about SQL syntax is only about 20 pages in print. My advice to whoever generated this INSERT, is: read it 🙂 it will pay off.

    Real solution

    Now, to the point… To transfer table from sqlite to postgres, you should use COPY because it’s way faster than INSERT.

    Use CSV format as it’s understood on both sides.

    In sqlite3:

    create table tbl1(one varchar(20), two smallint);
    insert into tbl1 values('hello',10);
    insert into tbl1 values('with,comma', 20);
    insert into tbl1 values('with "quotes"', 30);
    insert into tbl1 values('with
    enter', 40);
    .mode csv
    .header on
    .out tbl1.csv
    select * from tbl1;
    

    In PostgreSQL (psql client):

    create table tbl1(one varchar(20), two smallint);
    \copy tbl1 from 'tbl1.csv' with csv header delimiter ','
    select * from tbl1;
    

    See http://wiki.postgresql.org/wiki/COPY.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Using sqlite3, I have two tables: products, orders. I want to know how many
I have many tables with identical schemas but different names. Can I create a
I have many tables in my database which are interrelated. I have a table
I have many tables that use Lookup/Enum references for most of their column values.
Does anyone has any insight on organizing sqlalchemy based projects? I have many tables
I have database with many tables. In the first table, I have a field
I have some tables that benefit from many-to-many tables. For example the team table.
I have an access database with many tables. I am looking for a field
I have 3 tables users(id,name),groups(id,name) and users_groups(user_id,group_id). users and groups have many to many
Say I have 2 tables: Customers and Orders. A Customer can have many Orders.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.