Index: openacs-4/packages/xotcl-core/tcl/05-db-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xotcl-core/tcl/05-db-procs.tcl,v diff -u -r1.66 -r1.67 --- openacs-4/packages/xotcl-core/tcl/05-db-procs.tcl 5 May 2008 10:13:01 -0000 1.66 +++ openacs-4/packages/xotcl-core/tcl/05-db-procs.tcl 5 May 2008 12:16:56 -0000 1.67 @@ -82,21 +82,26 @@ # ::xotcl::Object create require - require set postgresql_table_exists {select 1 from pg_tables where tablename = '$name'} - require set postgresql_view_exists {select 1 from pg_views where viewname = '$name'} - require set postgresql_index_exists {select 1 from pg_indexes where indexname = '$name'} + #require set postgresql_table_exists {select 1 from pg_tables where tablename = '$name'} + require set postgresql_table_exists {select 1 from pg_class where relname = '$name' and\ + pg_table_is_visible(oid)} + require set postgresql_view_exists {select 1 from pg_views where viewname = '$name'} + require set postgresql_index_exists {select 1 from pg_indexes where indexname = '$name'} require set oracle_table_exists {select 1 from user_tables where table_name = '$name'} require set oracle_view_exists {select 1 from user_views where view_name = '$name'} require set oracle_index_exists {select 1 from user_indexes where index_name = '$name'} require proc exists_table {name} { - if {[db_driverkey ""] eq "oracle"} {set name [string toupper $name]} + if {[db_driverkey ""] eq "oracle"} { + set name [string toupper $name] + } else { + set name [string tolower $name] + } db_0or1row [my qn ""] [subst [my set [db_driverkey ""]_table_exists]] } require proc table {name definition} { - if {[db_driverkey ""] eq "oracle"} {set name [string toupper $name]} - if {![db_0or1row [my qn ""] [subst [my set [db_driverkey ""]_table_exists]]]} { + if {![my exists_table $name]} { #my log "--table $name does not exist, creating with $definition" db_dml [my qn create-table-$name] "create table $name ($definition)" }