Forum OpenACS Q&A: Ecommerce /admin/orders/fulfill-3 Request Error

When attempting to report a shipment of an authorized order, am getting a Request Error page when proceeding from /ecommerce/admin/orders/fulfill-2 to ../fulfill-3:

Database operation "0or1row" failed (exception NSDB, "Query was not a statement returning rows.")
    while executing
"ns_pg_bind 0or1row nsdb0 {
	    select 0.54 + shipping_charged 
	    from ec_orders 
	    where order_id=:order_id}"
(complete error listed below)

This is with pg7.2, aolserver 3.4.2, openacs 4.6.3 ecommerce.

Any ideas on the origin of this error?
Does the shipment-gateway need to be installed even if it's not used?
I've tried items via bulk upload and direct entry with same result. All items are "shipping avail."

Here's the details from the log:

23/Jan/2004:06:33:05][69412.136235008][-sched:8-] Notice: Done running scheduled proc acs_mail_lite::sweeper.
<Unamed set>:
        order_id = 3000016
        item_id = 19
        shipment_date.month = January
        shipment_date.day = 23
        shipment_date.year = 2004
        shipment_time.time = 6:32:29
        shipment_time.ampm = AM
        expected_arrival_date.month = January
        expected_arrival_date.day = 28
        expected_arrival_date.year = 2004
        expected_arrival_time.time =
        expected_arrival_time.ampm =
        carrier = UPS Ground
        carrier_other =
        tracking_number = available by request
: 7 message: ERROR:  Unable to identify an operator '+' for types 'double precision' and 'numeric'
        You will have to retype this query using an explicit cast

[23/Jan/2004:06:33:38][69412.135962624][-conn4-] Notice: RP (90.471 ms): error in rp_handler: serving POST /ecommerce/admin\
/orders/fulfill-3
        ad_url "/ecommerce/admin/orders/fulfill-3" maps to file "/usr/local/www/dekka.com/openacs-4-6/packages/ecommerce/ww\
w/admin/orders/fulfill-3.tcl"
errmsg is Database operation "0or1row" failed (exception NSDB, "Query was not a statement returning rows.")
[23/Jan/2004:06:33:38][69412.135962624][-conn4-] Error: POST http://dekka.com:8000/ecommerce/admin/orders/fulfill-3?
referred by "http://dekka.com:8000/ecommerce/admin/orders/fulfill-2"
Database operation "0or1row" failed (exception NSDB, "Query was not a statement returning rows.")
    while executing
"ns_pg_bind 0or1row nsdb0 {
            select 0.00 + shipping_charged
            from ec_orders
            where order_id=:order_id}"
    ("uplevel" body line 1)
    invoked from within
"uplevel $ulevel [list ns_pg_bind $type $db $sql"
    invoked from within
"db_exec 0or1row $db $full_name $sql"
    invoked from within
"set selection [db_exec 0or1row $db $full_name $sql]"
    ("uplevel" body line 2)
    invoked from within
"uplevel 1 $code_block "
    invoked from within
"db_with_handle db {
        set selection [db_exec 0or1row $db $full_name $sql]
    }"
    (procedure "db_string" line 7)
    invoked from within
"db_string total_shipping_of_items_select "
            select $shipping_of_items + shipping_charged
            from ec_orders
            where order_id=:order_id""
    invoked from within
"if { $shippable_p } {

    # See if base shipping cost should be included in
    # total_shipping_of_items

    set n_shipments_already [db_string n_s..."
    ("uplevel" body line 87)
    invoked from within
"uplevel {
          ad_page_contract {

    @author Eve Andersson (eveander@arsdigita.com)
    @creation-date Summer 1999
    @author ported by Jerry Ash..."
    (procedure "code::tcl::/usr/local/www/dekka.com/openacs-4-6/packages/eco..." line 2)
    invoked from within
"code::tcl::$__adp_stub"
    invoked from within
"if { [file exists $__adp_stub.tcl] } {

      # ensure that data source preparation procedure exists and is up-to-date
      adp_init tcl $__adp_stub
..."
    ("uplevel" body line 3)
    invoked from within
"uplevel {

    if { [file exists $__adp_stub.tcl] } {

      # ensure that data source preparation procedure exists and is up-to-date
      adp_init t..."
    (procedure "adp_prepare" line 2)
    invoked from within
"adp_prepare "
    (procedure "template::adp_parse" line 30)
    invoked from within
"template::adp_parse [file root [ad_conn file]] {}"
    (procedure "adp_parse_ad_conn_file" line 7)
    invoked from within
"$handler"
    ("uplevel" body line 2)
    invoked from within
"uplevel $code"
    invoked from within
"ad_try {
        $handler
      } ad_script_abort val {
        # do nothing
      }"
    invoked from within
"rp_serve_concrete_file [ad_conn file]"
    (procedure "rp_serve_abstract_file" line 60)
    invoked from within
"rp_serve_abstract_file "$root/$path""
    ("uplevel" body line 2)
    invoked from within
"uplevel $code"
    invoked from within
"ad_try {
        rp_serve_abstract_file "$root/$path"
        set tcl_url2file([ad_conn url]) [ad_conn file]
        set tcl_url2path_info([ad_conn url]) [ad_conn path_inf..."
[23/Jan/2004:06:33:58][69412.135518208][-sched-] Notice: Running scheduled proc search_indexer...
Collapse
Posted by Torben Brosten on

More info.. This last request error was for order_id 3000018. From psql:

select shipping_charged, order_id from ec_orders where order_id = 3000018;
 shipping_charged | order_id
------------------+----------
             4.50 |  3000018
(1 row)

???

Is there a trigger somewhere that needs to fill this before an attempt is made to ship?

Collapse
Posted by Torben Brosten on
Just tried it again (knowing the value is there), but still get the same error... =(

I don't see anything listed in open/closed bugs, nor in the forums, so I must be doing something typically different than system expects... but what???

Collapse
Posted by Torben Brosten on
hmmm. the query total_shipping_of_items_select isn't defined in a .xql file, but it should still work...
Collapse
Posted by Torben Brosten on
Okay, there's a tcl sum stuck inside the db query. Putting that outside seems to have fixed it.

(I don't understand how these kinds of bugs still exist in ecommerce when it's been used for years.)

I'll file a bug report and patch.

Collapse
Posted by Bart Teeuwisse on
Torben,

the problem that you see is this:

7 message: ERROR:  Unable to identify an operator '+' for types 'double precision' and 'numeric'
        You will have to retype this query using an explicit cast

Are you sure you are using PG 7.2 and not a more resent version? Version 7.3 shored up type checking and that is what you encounter here. To PG 4.50 is a double precision data type while shipping_charged is defined as numeric (or vise versa). PG tells you it doesn't know how to add a double precision datatype to a numeric datatype. You'll have to cast one into the other.

/Bart

Collapse
Posted by Torben Brosten on

Hi Bart,

psql> select version();
                               version
---------------------------------------------------------------------
 PostgreSQL 7.2.4 on i386-unknown-freebsd4.9, compiled by GCC 2.95.4
(1 row)

Okay, it's using 7.2.4.

Now I know what to do if/when I see more of these. Thanks.