[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
1.3 error in AP->vendor invoice query
- Subject: 1.3 error in AP->vendor invoice query
- From: "David A. Bandel" <..hidden..>
- Date: Fri, 26 Jun 2009 21:49:42 -0500
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'
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.
Patch to LedgerSMB/IR.pm attached.
David A. Bandel
--
Focus on the dream, not the competition.
- Nemesis Air Racing Team motto
--- IR.pm.orig 2009-06-26 21:41:14.000000000 -0500
+++ IR.pm 2009-06-26 21:41:59.000000000 -0500
@@ -1071,7 +1071,8 @@
else {
$query = qq|
SELECT (select c.accno FROM chart c
- WHERE c.id = (SELECT value::int FROM defaults
+ WHERE c.charttype = 'A' and
+ c.id = (SELECT value::int FROM defaults
WHERE setting_key =
'inventory_accno_id'))
AS inventory_accno,