I've been playing around with the query error for a few hours. I
am trying to access index.tcl in the instance of the ecommerce
package which I created. In this case it's at /ecommerce/index. The
query that breaks is a dml which uses sysdate/current_timestamp. For
some reason, the QD is not reading the correct ported query in the -
postgresql.xql file.
Here are the relevant files:
packages/ecommerce/www/index.tcl (line 35):
ec_create_new_session_if_necessary ""
cookies_are_not_required
packages/ecommerce/tcl/ecommerce-procs.tcl (line 1441-1446 within
the procedure ec_create_new_session_if_necessary):
db_dml insert_user_session {
insert into ec_user_sessions
(user_session_id, ip_address, start_time,
http_user_agent)
values
(:user_session_id, :ip_address ,
sysdate, :http_user_agent)
}
packages/ecommerce/tcl/ecommerce-procs-postgresql.xql (lines 72-
81):
<fullquery
name="ec_create_new_session_if_necessary.insert_user_session">
<querytext>
insert into ec_user_sessions
(user_session_id, ip_address, start_time,
http_user_agent)
values
(:user_session_id, :ip_address,
current_timestamp, :http_user_agent)
<rytext>
</fullquery>
Two things I have tried:
- The ported files above. The error in the log file complains
about sysdate not being defined.
- Changed sysdate to current_timestamp in the
ecommerce/tcl/ecommerce-procs.tcl. This works!
So I got really confused. Then I turned on the debug mode. Here
is the output of the startup process and relevant lines near the
error:
[13/Jul/2001:17:46:06][2046.5][-conn0-] Debug: QD_LOGGER = LEVEL=0=
db_dml insert_user_session {
insert into ec_user_sessions
(user_session_id, ip_address, start_time,
http_user_agent)
values
(:user_session_id, :ip_address ,
sysdate, :http_user_agent)
}
[13/Jul/2001:17:46:06][2046.5][-conn0-] Debug: QD_LOGGER = LEVEL=1=
template::adp_parse /home/aol30/aolserver3.3/servers/openacs-
4/packages/ecommerce/www/index {}
[13/Jul/2001:17:46:06][2046.5][-conn0-] Debug: QD_LOGGER = LEVEL=2=
adp_parse_ad_conn_file
[13/Jul/2001:17:46:06][2046.5][-conn0-] Debug: QD_LOGGER = LEVEL=3=
rp_serve_concrete_file /home/aol30/aolserver3.3/servers/openacs-
4/packages/ecommerce/www/index.tcl
[13/Jul/2001:17:46:06][2046.5][-conn0-] Debug: QD_LOGGER = LEVEL=4=
rp_serve_abstract_file /home/aol30/aolserver3.3/servers/openacs-
4/packages/ecommerce/www/
[13/Jul/2001:17:46:06][2046.5][-conn0-] Debug: QD_LOGGER = LEVEL=5=
rp_handler
[13/Jul/2001:17:46:06][2046.5][-conn0-] Debug: QD_LOGGER = the
ad_conn file is /home/aol30/aolserver3.3/servers/openacs-
4/packages/ecommerce/www/index.tcl
[13/Jul/2001:17:46:06][2046.5][-conn0-] Debug: QD_LOGGER = We are in
a WWW page sourced by apm_source, woohoo!
[13/Jul/2001:17:46:06][2046.5][-conn0-] Debug: QD_LOGGER = package
key is ecommerce and rest is .www.index
[13/Jul/2001:17:46:06][2046.5][-conn0-] Debug: QD_LOGGER = generated
fullname of dbqd.ecommerce.www.index.insert_user_session
[13/Jul/2001:17:46:06][2046.5][-conn0-] Debug: QD_LOGGER = PRE-QD:
the SQL is
insert into ec_user_sessions
(user_session_id, ip_address, start_time,
http_user_agent)
values
(:user_session_id, :ip_address ,
sysdate, :http_user_agent)
for dbqd.ecommerce.www.index.insert_user_session
[13/Jul/2001:17:46:06][2046.5][-conn0-] Debug: QD_LOGGER = NO
FULLQUERY FOR dbqd.ecommerce.www.index.insert_user_session --> using
default SQL
[13/Jul/2001:17:46:06][2046.5][-conn0-] Debug: QD_LOGGER = POST-QD:
the SQL is
insert into ec_user_sessions
(user_session_id, ip_address, start_time,
http_user_agent)
values
(:user_session_id, :ip_address ,
sysdate, :http_user_agent)
[13/Jul/2001:17:46:06][2046.5][-conn0-] Debug: PgBindCmd: sql =
insert into ec_user_sessions
(user_session_id, ip_address, start_time,
http_user_agent)
values
(:user_session_id, :ip_address ,
sysdate, :http_user_agent)
[13/Jul/2001:17:46:06][2046.5][-conn0-] Debug: PgBindCmd: bind var:
user_session_id = 22
[13/Jul/2001:17:46:06][2046.5][-conn0-] Debug: PgBindCmd: bind var:
ip_address = 15.111.20.6
[13/Jul/2001:17:46:06][2046.5][-conn0-] Debug: PgBindCmd: bind var:
http_user_agent = Mozilla/4.0 (compatible; MSIE 5.01; Windows NT;
Hewlett-Packard IE5.01 SP1)
[13/Jul/2001:17:46:06][2046.5][-conn0-] Debug: PgBindCmd: query with
bind variables substituted =
insert into ec_user_sessions
(user_session_id, ip_address, start_time,
http_user_agent)
values
('22', '15.111.20.6' , sysdate, 'Mozilla/4.0
(compatible; MSIE 5.01; Windows NT; Hewlett-Packard IE5.01 SP1)')
[13/Jul/2001:17:46:06][2046.5][-conn0-] Notice: Querying '
insert into ec_user_sessions
(user_session_id, ip_address, start_time,
http_user_agent)
values
('22', '15.111.20.6' , sysdate, 'Mozilla/4.0
(compatible; MSIE 5.01; Windows NT; Hewlett-Packard IE5.01 SP1)');'
[13/Jul/2001:17:46:06][2046.5][-conn0-] Error: Ns_PgExec: result
status: 7 message: ERROR: Attribute 'sysdate' not found
[13/Jul/2001:17:46:06][2046.5][-conn0-] Error: dbinit: error
(localhost::openacs-4,ERROR: Attribute 'sysdate' not found
): '
insert into ec_user_sessions
(user_session_id, ip_address, start_time,
http_user_agent)
values
('22', '15.111.20.6' , sysdate, 'Mozilla/4.0
(compatible; MSIE 5.01; Windows NT; Hewlett-Packard IE5.01 SP1)')
'
[13/Jul/2001:17:46:06][2046.5][-conn0-] Notice: RP (788.032 ms):
error in rp_handler: serving GET /ecommerce/
ad_url "/ecommerce/" maps to
file "/home/aol30/aolserver3.3/servers/openacs-
4/packages/ecommerce/www/index.tcl"
errmsg is Database operation "dml" failed
The line which is interesting says:
[13/Jul/2001:17:46:06][2046.5][-conn0-] Debug: QD_LOGGER = NO
FULLQUERY FOR dbqd.ecommerce.www.index.insert_user_session --> using
default SQL
It looks like the name given to the tcl procedure by the Query
Extractor does not match what the Query Dispatcher created. Is this
a bug in the QD?
Thanks.