Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PostgreSQL prepared statements for functions and tablespace option for schema builds #95

Merged
merged 2 commits into from
Feb 4, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions config/postgresql.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
<pg_user>tpcc</pg_user>
<pg_pass>tpcc</pg_pass>
<pg_dbase>tpcc</pg_dbase>
<pg_tspace>pg_default</pg_tspace>
<pg_vacuum>false</pg_vacuum>
<pg_dritasnap>false</pg_dritasnap>
<pg_oracompat>false</pg_oracompat>
Expand Down Expand Up @@ -43,6 +44,7 @@
<pg_tpch_user>tpch</pg_tpch_user>
<pg_tpch_pass>tpch</pg_tpch_pass>
<pg_tpch_dbase>tpch</pg_tpch_dbase>
<pg_tpch_tspace>pg_default</pg_tpch_tspace>
<pg_tpch_gpcompat>false</pg_tpch_gpcompat>
<pg_tpch_gpcompress>false</pg_tpch_gpcompress>
<pg_num_tpch_threads>1</pg_num_tpch_threads>
Expand Down
13 changes: 8 additions & 5 deletions src/postgresql/pgolap.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,15 @@ pg_result $result -clear
return $lda
}

proc CreateUserDatabase { lda db superuser user password } {
proc CreateUserDatabase { lda db tspace superuser user password } {
set stmnt_count 3
if { $tspace != "pg_default" } { incr stmnt_count }
puts "CREATING DATABASE $db under OWNER $user"
set sql(1) "CREATE USER $user PASSWORD '$password'"
set sql(2) "GRANT $user to $superuser"
set sql(3) "CREATE DATABASE $db OWNER $user"
for { set i 1 } { $i <= 3 } { incr i } {
set sql(4) "ALTER DATABASE $db SET TABLESPACE $tspace"
for { set i 1 } { $i <= $stmnt_count } { incr i } {
set result [ pg_exec $lda $sql($i) ]
if {[pg_result $result -status] != "PGRES_COMMAND_OK"} {
error "[pg_result $result -error]"
Expand Down Expand Up @@ -518,7 +521,7 @@ error "[pg_result $result -error]"
return
}

proc do_tpch { host port scale_fact superuser superuser_password defaultdb db user password greenplum gpcompress num_vu } {
proc do_tpch { host port scale_fact superuser superuser_password defaultdb db tspace user password greenplum gpcompress num_vu } {
global dist_names dist_weights weights dists weights
###############################################
#Generating following rows
Expand Down Expand Up @@ -575,7 +578,7 @@ set lda [ ConnectToPostgres $host $port $superuser $superuser_password $defaultd
if { $lda eq "Failed" } {
error "error, the database connection to $host could not be established"
} else {
CreateUserDatabase $lda $db $superuser $user $password
CreateUserDatabase $lda $db $tspace $superuser $user $password
set result [ pg_exec $lda "commit" ]
pg_result $result -clear
pg_disconnect $lda
Expand Down Expand Up @@ -679,7 +682,7 @@ return
}
}
}
.ed_mainFrame.mainwin.textFrame.left.text fastinsert end "do_tpch $pg_host $pg_port $pg_scale_fact $pg_tpch_superuser $pg_tpch_superuserpass $pg_tpch_defaultdbase $pg_tpch_dbase $pg_tpch_user $pg_tpch_pass $pg_tpch_gpcompat $pg_tpch_gpcompress $pg_num_tpch_threads"
.ed_mainFrame.mainwin.textFrame.left.text fastinsert end "do_tpch $pg_host $pg_port $pg_scale_fact $pg_tpch_superuser $pg_tpch_superuserpass $pg_tpch_defaultdbase $pg_tpch_dbase $pg_tpch_tspace $pg_tpch_user $pg_tpch_pass $pg_tpch_gpcompat $pg_tpch_gpcompress $pg_num_tpch_threads"
} else { return }
}

Expand Down
Loading