Forum OpenACS Q&A: sitemap broken after db import

Collapse
Posted by Tom Lazar on
hello,

i am trying to use a local copy of my 'production' oacs site for development purposes. after much help from others, i am finally running oacs on my TiBook, however, i cannot access the site map anymore.

what i did was to make a dump of the postgresql database (pg_dumpall) and piped that into my local instance of postgresql. next, i copied the entire webfolder of my production site onto the powerbook, as well. after modifying the startup-tcl, everything was fine: my site looks and behaves in the local version just as it does on the server.

EXCEPT, that when i log in as admin and try to access the sitemap I get the following error, which tells me absolutely nothing...

I've restarted the database, the nsd process, vacuumed and analyzed the db and sacrificed a chicken (i was hungry) but to no avail...

i am running openacs 4.6.2 beta and postgresql 7.2.4 (on both systems).

apart from being inconvenient this also makes me worry a bit: what if the same thing would happen to me with a production site of a (future) client?

as usual, any comments are greatly appreciated, thanks!

--snip--
Database operation "select" failed (exception NSDB, "Query was not a statement returning rows.")

ERROR:  Function 'tree_ancestor_keys(varbit)' does not exist
        Unable to identify a function that satisfies the given argument types
        You may need to add explicit typecasts

SQL:
            select s2.node_id,
                  s2.name,
                  s2.directory_p,
                  tree_level(s2.tree_sortkey) as level,
                  acs_object__name(s2.object_id) as obj_name,
                  acs_permission__permission_p(s2.object_id, '2121', 'admin') as admin_p
            from (select tree_ancestor_keys(site_node_get_tree_sortkey('2115')) as tree_sortkey) parents,
                site_nodes s2
            where s2.tree_sortkey = parents.tree_sortkey
            order by level

    while executing
"ns_pg_bind select nsdb0 {
            select s2.node_id,
                  s2.name,
                  s2.directory_p,
                  tree_level(..."
    ("uplevel" body line 1)
    invoked from within
"uplevel $ulevel [list ns_pg_bind $type $db $sql"
    invoked from within
"db_exec select $db $full_statement_name $sql"
    invoked from within
"set selection [db_exec select $db $full_statement_name $sql]"
    ("uplevel" body line 2)
    invoked from within
"uplevel 1 $code_block "
    invoked from within
"db_with_handle db {
        set selection [db_exec select $db $full_statement_name $sql]

        set counter 0
        while { [db_getrow $db $selection] } {
            incr co..."
    (procedure "db_foreach" line 35)
    invoked from within
"db_foreach path_select {} {
  if {$node_id != $root_id && $admin_p == "t"} {
    doc_body_append "<a href=.?[export_url_vars expand:multiple root_id=$..."
    ("uplevel" body line 65)
    invoked from within
"uplevel {
          ad_page_contract {

    @author mailto:rhs@mit.edu
    @author mailto:bquinn@arsidigta.com
    @creation-date 2000-09-09
    @cvs-id $Id: index.tcl..."
    (procedure "code::tcl::/Volumes/kerouac/tomster/Projects/tomster.org/tom..." 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..."

--snap

Collapse
Posted by Tilmann Singer on
Before restoring a pg dump file from an openacs instance you have to load packages/acs-kernel/sql/postgresql/postgresql.sql manually, otherwise these tree_sortkey functions (and lots in oacs depends on them, this error is not the only one you will run into) won't be created.
Collapse
Posted by Tom Lazar on
tilmann,

does this mean, that i first need to initialise the local version using an empty oacs 4.6.2 and *then* run the abovementioned sql script and *then* import the dump?

or do i just run the script from the copied oacs installation?

and finally, do i 'run' that script by doing

psql tomsterorg < packages/acs-kernel/sql/postgresql/postgresql.sql

?

did i miss this bit somewhere in the documentation or is one just supposed to know?

thanks,

T.

Collapse
Posted by Tilmann Singer on
That's the required sequence of actions:

createdb yourdb
psql yourdb < ..../postgresql.sql
psql yourdb < your_dump_file.sql

Otherwise some things in your dumpfile will fail to create I guess.

I don't know if that is mentioned in the docs - it should be for sure. Feel free to add it if it's missing 😉

Collapse
Posted by Jon Griffin on
I thinking sourcing that file to template1 would also solve th e problem.
Collapse
Posted by Tom Lazar on
tilmann,

thanks for the hint: the sitemap is now working on my local copy and my faith in oacs has been restored *eg*

Ion,

I haven't tried out your hint this time, but thanks to you too ;)