Convert Sqlite SQL, especially as produced by Firefox, into PostgreSQL
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
.gitignore
LICENSE.md
Makefile
README.md
sqlite-to-pgsql
sqlite-to-pgsql.awk
tests.good.pgsql
tests.sqlite

README.md

sqlite-to-pgsql

Purpose

Some scripts to convert sqlite databases into SQL which can be loaded into PostgreSQL. Especially developed and tested for the sqlite databases produced by Firefox.

Contents

FILE PURPOSE
Makefile tells make how to run tests
README.md this file
sqlite-to-pgsql master shell script
sqlite-to-pgsql.awk awk script that does the real work
tests.debug debug output of running tests
tests.good.pgsql what the tests are supposed to look like
tests.pgsql sql output of running tests
tests.sqlite input for running tests

Some ways to improve it

Automatically adding missing columns and types

Some of the fields in Mozilla's places.sqlite database are incompletely defined, lacking types. I've put in some fallback types in the awk script but this is very much a kludge.

A better solution would be to make a pre-pass over the sqlite data to collect the field names used and analyze the values being given which could then be used in the main pass to declare missing types and fix wonky types.