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

Re: 1.3 error in AP->vendor invoice query





On Fri, Jun 26, 2009 at 7:54 PM, Chris Travers <..hidden..> wrote:


On Fri, Jun 26, 2009 at 7:49 PM, David A. Bandel <..hidden..> wrote:
Chris and crew:

While testing 1.3 from svn, I got the following error when selecting
AP -> Vendor Invoice:
ERROR: more than one row returned by a subquery used as an _expression_

I ran the query subselect by subselect and found that the offending
query subselect is:
SELECT value::int FROM defaults
WHERE setting_key = 'inventory_accno_id'

Hmmm... sounds like we are missing a unique constraint....  Will get that fixed asap....
I take that back....,
 



which is part of the first subselect:

SELECT (select c.accno FROM chart c
WHERE c.id = (SELECT value::int FROM defaults
WHERE setting_key =
'inventory_accno_id'))
AS inventory_accno,

For whatever reason, in my database, the view "chart" returns multiple
rows for several id numbers, those numbers obviously not being UNIQUE.

I will note, however, that the duplicates are of different
charttype(s), the sought after value having a charttype A (the other
being H).  Changing the subselect from to include "and c.charttype =
'A'" in IR.pm fixes the problem for me.

Ok.  Will make this change. 


Patch to LedgerSMB/IR.pm attached.

David A. Bandel
--
Focus on the dream, not the competition.
           - Nemesis Air Racing Team motto

------------------------------------------------------------------------------

_______________________________________________
Ledger-smb-devel mailing list
..hidden..
https://lists.sourceforge.net/lists/listinfo/ledger-smb-devel