My first problem:
At first it looked very odd as you can see NULL being passed explicitly for the heading column. On closer inspection of the table definition in Pg-database.sql:43 I can see it's a foreign key field. Looking at the account_save function definition in Accounts.sql:74 I can see it checks for NULL and swaps it for an ID from the account_headings table. So my problem is actually the SQL above:
INSERT INTO account_heading(id, accno, description)
SELECT id, accno, description
FROM lsmb12.chart WHERE charttype = 'H';
That isn't actually inserting anything:
# SELECT id, accno, description
# FROM lsmb12.chart WHERE charttype = 'H';
id | accno | description
----+-------+-------------
(0 rows)
# SELECT DISTINCT charttype FROM lsmb12.chart;
charttype
-----------
A
(1 row)
I don't have any H charttypes, only A. What should I do here?