Re: [sqlite] [EXTERNAL] Integration with las version of SQLite

2019-03-06 Thread Chris Locke
I fear the OP is referring to DB Browser for SQLite.  This recently
released v3.11.1.

@desarrollo - I would suggest contacting the DB Browser for SQLite
developers at this address:
https://github.com/sqlitebrowser/sqlitebrowser/issues


Thanks,
Chris

On Wed, Mar 6, 2019 at 3:47 PM Hick Gunter  wrote:

> The current version of SQLite itself is 3.27.2, Version 3.11.1 would be
> from 2016 and does not have window functions (introduced in Version 3.25)
>
> Please check which sqlite binding product you are using and see if it has
> a support page. If a query works from the sqlite shell but not from the
> program, it is not a problem with SQLite but with the
> binding/wrapper/whatever you are using.
>
> -Ursprüngliche Nachricht-
> Von: sqlite-users [mailto:sqlite-users-boun...@mailinglists.sqlite.org]
> Im Auftrag von desarrollo ribisoft
> Gesendet: Mittwoch, 06. März 2019 16:28
> An: sqlite-users@mailinglists.sqlite.org
> Betreff: [EXTERNAL] [sqlite] Integration with las version of SQLite
>
> Good morning,
>
> I have a project in c# which I integrate with SQLite and I have very good
> performance at all, I've had no troubles, but yesterday I updated to last
> version of SQLite 3.11.1 and began to use the ROW_NUMBER() function, and
> running the query in the interface of DB Lite I had no troubles, but when I
> run that same query in c# I'm getting errors because it doesn´t recognise
> that function, I'd like to know if you know how to update the connection or
> integration between c# and this last version of SQLite, thanks in advanced.
>
> --
> Muchas Gracias
>
> Cordialmente:
> ___
> sqlite-users mailing list
> sqlite-users@mailinglists.sqlite.org
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
>
>
> ___
>  Gunter Hick | Software Engineer | Scientific Games International GmbH |
> Klitschgasse 2-4, A-1130 Vienna | FN 157284 a, HG Wien, DVR: 0430013 | (O)
> +43 1 80100 - 0
>
> May be privileged. May be confidential. Please delete if not the addressee.
> ___
> sqlite-users mailing list
> sqlite-users@mailinglists.sqlite.org
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
>
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Equiv stmts, different explain plans

2019-03-06 Thread James K. Lowden
On Tue, 05 Mar 2019 13:58:06 -0700
"Keith Medcalf"  wrote:

> >The query requests no such thing.  SQL makes no request or
> >suggestion for how to execute a query.  It simply describes a result.
> >It's up to the implementation to determine how to produce that
> >result.
> 
> You are, of course, correct.  However for the two queries given I do
> not believe that any query planner currently in existence will
> recognize that t1.c == 1 and t2.c == 1 implies that t1.c == t2.c.  

Thank you for the clarification, Keith.  You may well be right about
the state of the art.  I fault SQL itself; if it implemented relational
algebra correctly, there would be no duplicates from SELECT, and no need
of DISTINCT.  Perhaps then the transformation of FORALL to JOIN would
be easier to infer.  

There is sometimes a tendency in this forum to use shorthand, to
describe what SQLite does as what SQL does.  It's useful for the users'
sake to distinguish between the two, so as not to confuse the
attainable with the attained.   :-) 

--jkl
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] [EXTERNAL] Integration with las version of SQLite

2019-03-06 Thread Hick Gunter
The current version of SQLite itself is 3.27.2, Version 3.11.1 would be from 
2016 and does not have window functions (introduced in Version 3.25)

Please check which sqlite binding product you are using and see if it has a 
support page. If a query works from the sqlite shell but not from the program, 
it is not a problem with SQLite but with the binding/wrapper/whatever you are 
using.

-Ursprüngliche Nachricht-
Von: sqlite-users [mailto:sqlite-users-boun...@mailinglists.sqlite.org] Im 
Auftrag von desarrollo ribisoft
Gesendet: Mittwoch, 06. März 2019 16:28
An: sqlite-users@mailinglists.sqlite.org
Betreff: [EXTERNAL] [sqlite] Integration with las version of SQLite

Good morning,

I have a project in c# which I integrate with SQLite and I have very good 
performance at all, I've had no troubles, but yesterday I updated to last 
version of SQLite 3.11.1 and began to use the ROW_NUMBER() function, and 
running the query in the interface of DB Lite I had no troubles, but when I run 
that same query in c# I'm getting errors because it doesn´t recognise that 
function, I'd like to know if you know how to update the connection or 
integration between c# and this last version of SQLite, thanks in advanced.

--
Muchas Gracias

Cordialmente:
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


___
 Gunter Hick | Software Engineer | Scientific Games International GmbH | 
Klitschgasse 2-4, A-1130 Vienna | FN 157284 a, HG Wien, DVR: 0430013 | (O) +43 
1 80100 - 0

May be privileged. May be confidential. Please delete if not the addressee.
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


[sqlite] Integration with las version of SQLite

2019-03-06 Thread desarrollo ribisoft
Good morning,

I have a project in c# which I integrate with SQLite and I have very good
performance at all, I've had no troubles, but yesterday I updated to last
version of SQLite 3.11.1 and began to use the ROW_NUMBER() function, and
running the query in the interface of DB Lite I had no troubles, but when I
run that same query in c# I'm getting errors because it doesn´t recognise
that function, I'd like to know if you know how to update the connection or
integration between c# and this last version of SQLite, thanks in advanced.

-- 
Muchas Gracias

Cordialmente:
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Segmentation fault running a query

2019-03-06 Thread Richard Hipp
This is another example of the problem described by ticket
https://www.sqlite.org/src/info/df46dfb631f75694 which is fixed in
version 3.27.2.

On 3/5/19, Peter Hardman  wrote:
> If i run the following query from Python 3.7 using the sqlite3 DBAPI
> adapter or from sqlitebrowser I get a segmentation fault.
>
> The query runs error free on PostgreSQL 9.6
>
> The query fails if the 'in' list has more than two entries.
>
> Any ideas?

-- 
D. Richard Hipp
d...@sqlite.org
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Segmentation fault running a query

2019-03-06 Thread Richard Hipp
On 3/6/19, Peter Hardman  wrote:
>
> I've attached the database file (300K).
>

Attachments are stripped by the mailing list.  Please send via private
email directly to me.
-- 
D. Richard Hipp
d...@sqlite.org
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Segmentation fault running a query

2019-03-06 Thread Peter Hardman
OK. I've anonymised the database and cut it down so that only the records 
extracted by the query are present. I have this feeling I've done something 
stupid with the data - but all the other queries I run against this database 
work fine.


It still gives a segfault when I run the query.

The SQLite3 version is SQLite 3.27.1 2019-02-08 13:17:39, built with zlib 
version 1.2.11 and gcc-8.2.1 20181127.


I've attached the database file (300K).



Dan Kennedy wrote on 06/03/2019 12:07:


On 6/3/62 16:37, Peter Hardman wrote:

So, I forgot I had emails from the list turned off

Integrity check shows no results.

The query fails from the CLI

The schema (of a very much cut down database) is attached.



Can you post the results of running the ".fullschema" command in the shell tool?

Thanks,

Dan.







And if it does still crash, please provide the database schema to help with 
debugging.



-Original Message-
From: sqlite-users [mailto:sqlite-users-bounces at mailinglists.sqlite.org] On 
Behalf Of Simon Slavin

Sent: Tuesday, March 05, 2019 3:14 PM
To: SQLite mailing list
Subject: Re: [sqlite] Segmentation fault running a query

On 5 Mar 2019, at 8:06pm, Peter Hardman  
wrote:

> If i run the following query from Python 3.7 using the sqlite3 DBAPI adapter 
or from sqlitebrowser I get a segmentation fault.


Please find the SQLite command-line tool on your computer.  If you don't 
already have one you can download one for your platform in the section 
"Precompiled Binaries" on




Using that program, please run

PRAGMA integrity_check;

If that reports no problems (should return no results) then please run your 
SELECT query in that program just to verify that it gets the same result your 
own code does.


___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


--

Peter Hardman
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Segmentation fault running a query

2019-03-06 Thread Dan Kennedy


On 6/3/62 16:37, Peter Hardman wrote:

So, I forgot I had emails from the list turned off

Integrity check shows no results.

The query fails from the CLI

The schema (of a very much cut down database) is attached.



Can you post the results of running the ".fullschema" command in the 
shell tool?


Thanks,

Dan.







And if it does still crash, please provide the database schema to help 
with debugging.



-Original Message-
From: sqlite-users [mailto:sqlite-users-bounces at 
mailinglists.sqlite.org] On Behalf Of Simon Slavin

Sent: Tuesday, March 05, 2019 3:14 PM
To: SQLite mailing list
Subject: Re: [sqlite] Segmentation fault running a query

On 5 Mar 2019, at 8:06pm, Peter Hardman somborneshetlands.co.uk> wrote:


> If i run the following query from Python 3.7 using the sqlite3 DBAPI 
adapter or from sqlitebrowser I get a segmentation fault.


Please find the SQLite command-line tool on your computer.  If you 
don't already have one you can download one for your platform in the 
section "Precompiled Binaries" on




Using that program, please run

PRAGMA integrity_check;

If that reports no problems (should return no results) then please run 
your SELECT query in that program just to verify that it gets the same 
result your own code does.


___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Segmentation fault running a query

2019-03-06 Thread Keith Medcalf

I was not able to reproduce it.  I arrived at the following decoded schema and 
query:

CREATE TABLE version (
major_version INTEGER NOT NULL PRIMARY KEY,
minor_version INTEGER NOT NULL,
paradox_upload TEXT,
converted TIMESTAMP NOT NULL,
created TIMESTAMP NOT NULL
);
CREATE TABLE mem_class (
class_name VARCHAR(16) NOT NULL PRIMARY KEY,
description VARCHAR(32) NOT NULL UNIQUE,
base_subscription INTEGER NOT NULL,
discount INTEGER NOT NULL,
renewal_period INTEGER NOT NULL,
joining_fee INTEGER NOT NULL,
votes INTEGER NOT NULL,
renewal_notice INTEGER NOT NULL CHECK(renewal_notice in (0, 1)),
is_active INTEGER NOT NULL CHECK(is_active in (0, 1)),
change_reason VARCHAR(32) NOT NULL,
last_changed TIMESTAMP NOT NULL
);
CREATE TABLE mem_dates (
renewal_date DATE NOT NULL PRIMARY KEY,
discount_end_date DATE NOT NULL,
membership_ceases DATE NOT NULL,
joiner_rollfwd_date DATE NOT NULL,
last_renewal_date DATE NOT NULL,
next_renewal_date DATE NOT NULL,
change_reason VARCHAR(32) NOT NULL,
last_changed TIMESTAMP NOT NULL
);
CREATE TABLE pmt_method (
pmt_method VARCHAR(16) NOT NULL PRIMARY KEY,
method_code VARCHAR(8) NOT NULL UNIQUE,
change_reason VARCHAR(32) NOT NULL,
last_changed TIMESTAMP NOT NULL
);
CREATE TABLE mem_source (
source VARCHAR(32) NOT NULL PRIMARY KEY,
source_code VARCHAR(8) NOT NULL UNIQUE,
change_reason VARCHAR(32) NOT NULL,
last_changed TIMESTAMP NOT NULL
);
CREATE TABLE nonren_reason (
reason VARCHAR(64) NOT NULL PRIMARY KEY,
reason_code VARCHAR(8) NOT NULL UNIQUE,
change_reason VARCHAR(32) NOT NULL,
last_changed TIMESTAMP NOT NULL
);
CREATE TABLE phone_type (
phone_type VARCHAR(16) NOT NULL PRIMARY KEY,
change_reason VARCHAR(32) NOT NULL,
last_changed TIMESTAMP NOT NULL
);
CREATE TABLE role_type (
role_type VARCHAR(32) NOT NULL PRIMARY KEY,
role_code VARCHAR(1) NOT NULL,
change_reason VARCHAR(32) NOT NULL,
last_changed TIMESTAMP NOT NULL
);
CREATE TABLE county (
county VARCHAR(32) NOT NULL PRIMARY KEY,
county_code VARCHAR(2) NOT NULL UNIQUE,
change_reason VARCHAR(32) NOT NULL,
last_changed TIMESTAMP NOT NULL
);
CREATE TABLE adj_county (
rec_id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
county VARCHAR(32) NOT NULL REFERENCES county (county) ON UPDATE RESTRICT 
ON DELETE RESTRICT,
adj_county VARCHAR(32) NOT NULL REFERENCES county (county) ON UPDATE 
RESTRICT ON DELETE RESTRICT,
change_reason VARCHAR(32) NOT NULL,
last_changed TIMESTAMP NOT NULL,
CONSTRAINT adj_county_key UNIQUE (county, adj_county)
);
CREATE TABLE country (
country VARCHAR(32) NOT NULL PRIMARY KEY,
country_code VARCHAR(2) NOT NULL UNIQUE,
calling_code VARCHAR(4) NOT NULL CHECK(calling_code REGEXP '^[0-9 ]*$'),
change_reason VARCHAR(32) NOT NULL,
last_changed TIMESTAMP NOT NULL
);
CREATE TABLE region (
region VARCHAR(32) NOT NULL PRIMARY KEY,
region_code VARCHAR(2) NOT NULL UNIQUE,
change_reason VARCHAR(32) NOT NULL,
last_changed TIMESTAMP NOT NULL
);
CREATE TABLE in_region (
rec_id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
region VARCHAR(32) NOT NULL REFERENCES region (region) ON UPDATE RESTRICT 
ON DELETE RESTRICT,
county VARCHAR(32) NOT NULL REFERENCES county (county) ON UPDATE RESTRICT 
ON DELETE RESTRICT,
country VARCHAR(32) NOT NULL REFERENCES country (country) ON UPDATE 
RESTRICT ON DELETE RESTRICT,
change_reason VARCHAR(32) NOT NULL,
last_changed TIMESTAMP NOT NULL,
CONSTRAINT in_region_key UNIQUE (region, county, country)
);
CREATE TABLE post_area (
outward_code VARCHAR(4) NOT NULL PRIMARY KEY,
area_name VARCHAR(32) NOT NULL UNIQUE,
latitude FLOAT NOT NULL,
longitude FLOAT NOT NULL,
easting INTEGER NOT NULL,
northing INTEGER NOT NULL,
grid_ref CHARACTER(8) NOT NULL,
change_reason VARCHAR(32) NOT NULL,
last_changed TIMESTAMP NOT NULL
);
CREATE TABLE person (
person_id INTEGER NOT NULL PRIMARY KEY,
active INTEGER NOT NULL CHECK(active in (0, 1)),
title VARCHAR(20) NOT NULL,
initials VARCHAR(30) NOT NULL,
forename VARCHAR(40) NOT NULL,
surname VARCHAR(40) NOT NULL,
created TIMESTAMP NOT NULL,
change_reason VARCHAR(32) NOT NULL,
last_changed TIMESTAMP NOT NULL
);
CREATE TABLE member (
member_no VARCHAR(6) NOT NULL PRIMARY KEY,
primary_person_id INTEGER NOT NULL REFERENCES person (person_id) ON UPDATE 
RESTRICT ON DELETE RESTRICT,
address_1 VARCHAR(30) NOT NULL,
address_2 VARCHAR(30) NOT NULL,
address_3 VARCHAR(30) NOT NULL,
post_town VARCHAR(24) NOT NULL,
county VARCHAR(32) NOT NULL REFERENCES county (county) ON UPDATE RESTRICT 
ON DELETE RESTRICT,
post_code VARCHAR(16) NOT NULL,
country VARCHAR(32) NOT NULL REFERENCES country (country) ON UPDATE 
RESTRICT ON DELETE RESTRICT,
share_info CHAR(8) NOT NULL,
joined DATE NOT NULL,
non_renewal 

Re: [sqlite] Safe (atomic) db file snapshot and update

2019-03-06 Thread Chris Locke
> Multiple processes write to foo.db.

What method of journaling do you use?  WAL?

> Multiple processes read foo.db (no writes at all).

Do they open a connection, read, then close the connection, or do you open
a connection, read, read, read, read, until the process is terminated, THEN
close the connection?  (ie, is the connection open all the time)


Thanks,
Chris

On Wed, Mar 6, 2019 at 11:33 AM Anton Polonskiy 
wrote:

> Scenario 1:
> Multiple processes write to foo.db.
> I want to do some periodic snapshots.
> What is the best way to do this without interrupting/blocking writers?
> sqlite3 foo.db '.backup snapshot.db' ?
>
> Scenario 2:
> Multiple processes read foo.db (no writes at all).
> I need to update foo.db without readers interruption and blocking.
> What is the best way to do this?
> mv foo-new.db foo.db ?
> ___
> sqlite-users mailing list
> sqlite-users@mailinglists.sqlite.org
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
>
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


[sqlite] Safe (atomic) db file snapshot and update

2019-03-06 Thread Anton Polonskiy
Scenario 1:
Multiple processes write to foo.db.
I want to do some periodic snapshots.
What is the best way to do this without interrupting/blocking writers?
sqlite3 foo.db '.backup snapshot.db' ?

Scenario 2:
Multiple processes read foo.db (no writes at all).
I need to update foo.db without readers interruption and blocking.
What is the best way to do this?
mv foo-new.db foo.db ?
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Segmentation fault running a query

2019-03-06 Thread Richard Hipp
On 3/6/19, Peter Hardman  wrote:
>
> The schema (of a very much cut down database) is attached.

I translated the attached schema into SQL and appended the query.  I
uploaded the result to https://sqlite.org/tmp/peter-hardman-001.txt

I have run the resulting script through every version of SQLite I have
at hand, and none of them given any trouble.  I also ran them under
Valgrind.  No problems detected.

Can anybody else reproduce the problem?

-- 
D. Richard Hipp
d...@sqlite.org
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


[sqlite] Segmentation fault running a query

2019-03-06 Thread Peter Hardman

So, I forgot I had emails from the list turned off

Integrity check shows no results.

The query fails from the CLI

The schema (of a very much cut down database) is attached.



And if it does still crash, please provide the database schema to help with 
debugging.



-Original Message-
From: sqlite-users [mailto:sqlite-users-bounces at mailinglists.sqlite.org] On 
Behalf Of Simon Slavin

Sent: Tuesday, March 05, 2019 3:14 PM
To: SQLite mailing list
Subject: Re: [sqlite] Segmentation fault running a query

On 5 Mar 2019, at 8:06pm, Peter Hardman  
wrote:

> If i run the following query from Python 3.7 using the sqlite3 DBAPI adapter 
or from sqlitebrowser I get a segmentation fault.


Please find the SQLite command-line tool on your computer.  If you don't already 
have one you can download one for your platform in the section "Precompiled 
Binaries" on




Using that program, please run

PRAGMA integrity_check;

If that reports no problems (should return no results) then please run your 
SELECT query in that program just to verify that it gets the same result your 
own code does.

--

Peter Hardman
('CREATE TABLE version (\nmajor_version INTEGER NOT NULL PRIMARY 
KEY,\nminor_version INTEGER NOT NULL,\nparadox_upload TEXT,\nconverted 
TIMESTAMP NOT NULL,\ncreated TIMESTAMP NOT NULL)',)
('CREATE TABLE mem_class (\nclass_name VARCHAR(16) NOT NULL PRIMARY 
KEY,\ndescription VARCHAR(32) NOT NULL UNIQUE,\nbase_subscription INTEGER NOT 
NULL,\ndiscount INTEGER NOT NULL,\nrenewal_period INTEGER NOT 
NULL,\njoining_fee INTEGER NOT NULL,\nvotes INTEGER NOT NULL,\nrenewal_notice 
INTEGER NOT NULL CHECK(renewal_notice in (0, 1)),\nis_active INTEGER NOT NULL 
CHECK(is_active in (0, 1)),\nchange_reason VARCHAR(32) NOT NULL,\nlast_changed 
TIMESTAMP NOT NULL)',)
('CREATE TABLE mem_dates (\nrenewal_date DATE NOT NULL PRIMARY 
KEY,\ndiscount_end_date DATE NOT NULL,\nmembership_ceases DATE NOT 
NULL,\njoiner_rollfwd_date DATE NOT NULL,\nlast_renewal_date DATE NOT 
NULL,\nnext_renewal_date DATE NOT NULL,\nchange_reason VARCHAR(32) NOT 
NULL,\nlast_changed TIMESTAMP NOT NULL)',)
('CREATE TABLE pmt_method (\npmt_method VARCHAR(16) NOT NULL PRIMARY 
KEY,\nmethod_code VARCHAR(8) NOT NULL UNIQUE,\nchange_reason VARCHAR(32) NOT 
NULL,\nlast_changed TIMESTAMP NOT NULL)',)
('CREATE TABLE mem_source (\nsource VARCHAR(32) NOT NULL PRIMARY 
KEY,\nsource_code VARCHAR(8) NOT NULL UNIQUE,\nchange_reason VARCHAR(32) NOT 
NULL,\nlast_changed TIMESTAMP NOT NULL)',)
('CREATE TABLE nonren_reason (\nreason VARCHAR(64) NOT NULL PRIMARY 
KEY,\nreason_code VARCHAR(8) NOT NULL UNIQUE,\nchange_reason VARCHAR(32) NOT 
NULL,\nlast_changed TIMESTAMP NOT NULL)',)
('CREATE TABLE phone_type (\nphone_type VARCHAR(16) NOT NULL PRIMARY 
KEY,\nchange_reason VARCHAR(32) NOT NULL,\nlast_changed TIMESTAMP NOT NULL)',)
('CREATE TABLE role_type (\nrole_type VARCHAR(32) NOT NULL PRIMARY 
KEY,\nrole_code VARCHAR(1) NOT NULL,\nchange_reason VARCHAR(32) NOT 
NULL,\nlast_changed TIMESTAMP NOT NULL)',)
('CREATE TABLE county (\ncounty VARCHAR(32) NOT NULL PRIMARY KEY,\ncounty_code 
VARCHAR(2) NOT NULL UNIQUE,\nchange_reason VARCHAR(32) NOT NULL,\nlast_changed 
TIMESTAMP NOT NULL)',)
('CREATE TABLE adj_county (\nrec_id INTEGER NOT NULL PRIMARY KEY 
AUTOINCREMENT,\ncounty VARCHAR(32) NOT NULL REFERENCES county (county) ON 
UPDATE RESTRICT ON DELETE RESTRICT,\nadj_county VARCHAR(32) NOT NULL REFERENCES 
county (county) ON UPDATE RESTRICT ON DELETE RESTRICT,\nchange_reason 
VARCHAR(32) NOT NULL,\nlast_changed TIMESTAMP NOT NULL,\nCONSTRAINT 
adj_county_key UNIQUE (county, adj_county))',)
('CREATE TABLE sqlite_sequence(name,seq)',)
("CREATE TABLE country (\ncountry VARCHAR(32) NOT NULL PRIMARY 
KEY,\ncountry_code VARCHAR(2) NOT NULL UNIQUE,\ncalling_code VARCHAR(4) NOT 
NULL CHECK(calling_code REGEXP '^[0-9 ]*$'),\nchange_reason VARCHAR(32) NOT 
NULL,\nlast_changed TIMESTAMP NOT NULL)",)
('CREATE TABLE region (\nregion VARCHAR(32) NOT NULL PRIMARY KEY,\nregion_code 
VARCHAR(2) NOT NULL UNIQUE,\nchange_reason VARCHAR(32) NOT NULL,\nlast_changed 
TIMESTAMP NOT NULL)',)
('CREATE TABLE in_region (\nrec_id INTEGER NOT NULL PRIMARY KEY 
AUTOINCREMENT,\nregion VARCHAR(32) NOT NULL REFERENCES region (region) ON 
UPDATE RESTRICT ON DELETE RESTRICT,\ncounty VARCHAR(32) NOT NULL REFERENCES 
county (county) ON UPDATE RESTRICT ON DELETE RESTRICT,\ncountry VARCHAR(32) NOT 
NULL REFERENCES country (country) ON UPDATE RESTRICT ON DELETE 
RESTRICT,\nchange_reason VARCHAR(32) NOT NULL,\nlast_changed TIMESTAMP NOT 
NULL,\nCONSTRAINT in_region_key UNIQUE (region, county, country))',)
('CREATE TABLE post_area (\noutward_code VARCHAR(4) NOT NULL PRIMARY 
KEY,\narea_name VARCHAR(32) NOT NULL UNIQUE,\nlatitude FLOAT NOT 
NULL,\nlongitude FLOAT NOT NULL,\neasting INTEGER NOT NULL,\nnorthing INTEGER 
NOT NULL,\ngrid_ref CHARACTER(8) NOT NULL,\nchange_reason VARCHAR(32) NOT 
NULL,\nlast_changed TIMESTAMP NOT NULL)',)
('CREATE TABLE person (\nperson_id