Forum .LRN Q&A: Similar problem with ETP, not LRN-related

Collapse
Posted by Roger Metcalf on
I'm posting this here instead of a new topic because it seems closely related. I've installed 4.6. On an ETP page I click "Create a new subtopic", give it a name and title, click Submit, and get:

Database operation "0or1row" failed (exception NSDB, "Query was not a statement returning rows.")
    while executing
"ns_pg_bind 0or1row nsdb0 {

	select site_node__new(NULL,:parent_id,:name,NULL,:directory_p,:pattern_p,:creation_user,:creation_ip)

      }"
    ("uplevel" body line 1)
    invoked from within
"uplevel $ulevel [list ns_pg_bind $type $db $sql"
    invoked from within
"db_exec 0or1row $db $full_statement_name $sql"
    invoked from within
"if {[regexp -nocase -- {^\s*select} $test_sql match]} {
            db_qd_log QDDebug "PLPGSQL: bypassed anon function"
            set selection [db_..."
    ("uplevel" body line 6)
    invoked from within
"uplevel 1 $code_block "
    invoked from within
"db_with_handle db {
        # plsql calls that are simple selects bypass the plpgsql 
        # mechanism for creating anonymous functions (OpenACS - ..."
    (procedure "db_exec_plsql" line 13)
    invoked from within
"db_exec_plsql create_object "
    BEGIN
      :1 := ${package_name}.new([plsql_utility::generate_attribute_parameter_call  -prepend ":"  -indent [expr..."
    (procedure "package_instantiate_object" line 113)
    invoked from within
"package_instantiate_object -extra_vars $extra_vars site_node"
    (procedure "site_node::new" line 10)
    invoked from within
"site_node::new -name $name -parent_id $parent_id"
    invoked from within
"set node_id [site_node::new -name $name -parent_id $parent_id]"
    ("uplevel" body line 3)
    invoked from within
"uplevel 1 $transaction_code "
    (procedure "db_transaction" line 1)
    invoked from within
"db_transaction {
            set node_id [site_node::new -name $name -pare..."
    (procedure "site_node_apm_integration::new_site_node_and_package" line 3)
    invoked from within
"site_node_apm_integration::new_site_node_and_package  -name $url_path_component  -parent_id $parent_node_id  -package_key $package_key  -instance_name..."
    (procedure "site_node_mount_application" line 12)
    invoked from within
"site_node_mount_application -return package_id $node_id $instance_name $package_key $pretty_name"
    (procedure "subsite::auto_mount_application" line 34)
    invoked from within
"subsite::auto_mount_application  -instance_name $subtopic_name  -pretty_name $subtopic_title "edit-this-page""
    invoked from within
"if { $confirmed == "t" } {
    if { [empty_string_p $subtopic_name] ||
         [regexp {[^a-zA-Z0-9\-_]} $subtopic_name] } {
	ad_return_complaint 1 "..."
    ("uplevel" body line 21)
...

In tracking this down a bit I find that package_instantiate_object seems to be calling site_node.new with a parameter string (generated by plsql_utility::generate_attribute_parameter_call) that looks like this:

(creation_user => :creation_user, creation_ip => :creation_ip, 
name => :name, parent_id => :parent_id, directory_p => :directory_p, pattern_p => :pattern_p)

That sure doesn't match the signature for function site_node__new:

create function site_node__new (integer,integer,varchar,integer,boolean,boolean,integer,varchar)
returns integer as '
declare
  new__node_id                alias for $1;  -- default null  
  new__parent_id              alias for $2;  -- default null    
  new__name                   alias for $3;  
  new__object_id              alias for $4;   -- default null   
  new__directory_p            alias for $5;  
  new__pattern_p              alias for $6;   -- default ''f'' 
  new__creation_user          alias for $7;   -- default null   
  new__creation_ip            alias for $8;   -- default null   
  v_node_id                   site_nodes.node_id%TYPE;
  v_directory_p               site_nodes.directory_p%TYPE;
begin
...

I don't know postgresql well yet but aren't parameters passed positionally, and doesn't that look like an Oracle argument list? What am I missing here?