[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Error when upgrading 1.2 db to 1.3 db



On 04/01/2012 15:52, Nigel Titley wrote:
On 04/01/12 15:43, Nigel Titley wrote:
On 03/01/12 18:27, Michael Richardson wrote:
"Nigel" == Nigel Titley<..hidden..>  writes:
     >>  No doesn't seem to have made any difference. Still the same error
     >>
     >>  psql:/tmp/ledgersmb/1.2-1.3-upgrade.sql:30: ERROR: null value in
     >>  column "heading" violates not-null constraint CONTEXT: SQL
     >>  statement "INSERT INTO account (accno, description, category,
     >>  gifi_accno, heading, contra, tax) VALUES ( $1 , $2 , $3 , $4 , $5
     >>  , $6 , $7 )" PL/pgSQL function "account_save" line 47 at SQL
     >>  statement

     Nigel>  Has anyone had any thoughts on this? I'm still stuck.

This is what I did.
I started my psql against my database.

The code at that line is:

SELECT account_save(id, accno, description, category, gifi_accno, NULL, contra,
                     CASE WHEN link like '%tax%' THEN true ELSE false END,
                     string_to_array(link,':'))
   FROM lsmb12.chart
  WHERE charttype = 'A';

so, I ran it like:

SELECT account_save(id, accno, description, category, gifi_accno, NULL, contra,
                     CASE WHEN link like '%tax%' THEN true ELSE false END,
                     string_to_array(link,':'))
   FROM lsmb12.chart
  WHERE charttype = 'A' ORDER BY accno OFFSET 0 LIMIT 1;

then incrementing the "OFFSET" value until I found the problem.

You may have to "delete from account;" if you have to retry things.

Many thanks... I'll work through and find out which account is causing
the problem.

Hmm, this fails at the first fence, with offset 0. I think its a more
fundamental error with the "account_save" procedure.

I'm still no further forward with this. Can someone put me in touch with the author of the migration script? I can't really move forward with testing 1.3 until we get an example database migrated across. And if we are having problems with the script, it's likely that someone else will have too.

Nigel