Skip to content

Commit

Permalink
Remove reconnect for PostgreSQL on windows (#402)
Browse files Browse the repository at this point in the history
  • Loading branch information
sm-shaw committed Aug 9, 2022
1 parent 3c0f687 commit 595c938
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 56 deletions.
5 changes: 0 additions & 5 deletions src/postgresql/pgmet.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -2042,11 +2042,6 @@ namespace eval pgmet {
set handle "Failed"
thread::send -async $parent "::callback_err [ join $err ]"
} else {
if {$tcl_platform(platform) == "windows"} {
#Workaround for Bug #95 where first connection fails on Windows
catch {pg_disconnect $handle}
set lda [pg_connect -conninfo [list host = $host port = $port sslmode = $sslmode user = $user password = $password dbname = $dbname ]]
}
pg_notice_handler $handle puts
set result [ pg_exec $handle "set CLIENT_MIN_MESSAGES TO 'ERROR'" ]
pg_result $result -clear
Expand Down
15 changes: 0 additions & 15 deletions src/postgresql/pgolap.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,6 @@ proc ConnectToPostgres { host port sslmode user password dbname } {
set lda "Failed" ; puts $message
error $message
} else {
if {$tcl_platform(platform) == "windows"} {
#Workaround for Bug #95 where first connection fails on Windows
catch {pg_disconnect $lda}
set lda [pg_connect -conninfo [list host = $host port = $port sslmode = $sslmode user = $user password = $password dbname = $dbname ]]
}
pg_notice_handler $lda puts
set result [ pg_exec $lda "set CLIENT_MIN_MESSAGES TO 'ERROR'" ]
pg_result $result -clear
Expand Down Expand Up @@ -783,11 +778,6 @@ proc ConnectToPostgres { host port sslmode user password dbname } {
set lda "Failed" ; puts $message
error $message
} else {
if {$tcl_platform(platform) == "windows"} {
#Workaround for Bug #95 where first connection fails on Windows
catch {pg_disconnect $lda}
set lda [pg_connect -conninfo [list host = $host port sslmode = $port sslmode = $sslmode user = $user password = $password dbname = $dbname ]]
}
pg_notice_handler $lda puts
set result [ pg_exec $lda "set CLIENT_MIN_MESSAGES TO 'ERROR'" ]
pg_result $result -clear
Expand Down Expand Up @@ -1377,11 +1367,6 @@ proc ConnectToPostgres { host port sslmode user password dbname } {
puts $message
error $message
} else {
if {$tcl_platform(platform) == "windows"} {
#Workaround for Bug #95 where first connection fails on Windows
catch {pg_disconnect $lda}
set lda [pg_connect -conninfo [list host = $host port = $port sslmode = $sslmode user = $user password = $password dbname = $dbname ]]
}
pg_notice_handler $lda puts
set result [ pg_exec $lda "set CLIENT_MIN_MESSAGES TO 'ERROR'" ]
pg_result $result -clear
Expand Down
31 changes: 0 additions & 31 deletions src/postgresql/pgoltp.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -1591,11 +1591,6 @@ proc ConnectToPostgres { host port sslmode user password dbname } {
set lda "Failed" ; puts $message
error $message
} else {
if {$tcl_platform(platform) == "windows"} {
#Workaround for Bug #95 where first connection fails on Windows
catch {pg_disconnect $lda}
set lda [pg_connect -conninfo [list host = $host port = $port sslmode = $sslmode user = $user password = $password dbname = $dbname ]]
}
pg_notice_handler $lda puts
set result [ pg_exec $lda "set CLIENT_MIN_MESSAGES TO 'ERROR'" ]
pg_result $result -clear
Expand Down Expand Up @@ -2543,11 +2538,6 @@ proc ConnectToPostgres { host port sslmode user password dbname } {
set lda "Failed" ; puts $message
error $message
} else {
if {$tcl_platform(platform) == "windows"} {
#Workaround for Bug #95 where first connection fails on Windows
catch {pg_disconnect $lda}
set lda [pg_connect -conninfo [list host = $host port = $port sslmode = $sslmode user = $user password = $password dbname = $dbname ]]
}
pg_notice_handler $lda puts
set result [ pg_exec $lda "set CLIENT_MIN_MESSAGES TO 'ERROR'" ]
pg_result $result -clear
Expand Down Expand Up @@ -2858,11 +2848,6 @@ proc ConnectToPostgres { host port sslmode user password dbname } {
set lda "Failed" ; puts $message
error $message
} else {
if {$tcl_platform(platform) == "windows"} {
#Workaround for Bug #95 where first connection fails on Windows
catch {pg_disconnect $lda}
set lda [pg_connect -conninfo [list host = $host port = $port sslmode = $sslmode user = $user password = $password dbname = $dbname ]]
}
pg_notice_handler $lda puts
set result [ pg_exec $lda "set CLIENT_MIN_MESSAGES TO 'ERROR'" ]
pg_result $result -clear
Expand Down Expand Up @@ -3290,11 +3275,6 @@ proc ConnectToPostgres { host port sslmode user password dbname } {
set lda "Failed" ; puts $message
error $message
} else {
if {$tcl_platform(platform) == "windows"} {
#Workaround for Bug #95 where first connection fails on Windows
catch {pg_disconnect $lda}
set lda [pg_connect -conninfo [list host = $host port = $port sslmode = $sslmode user = $user password = $password dbname = $dbname ]]
}
pg_notice_handler $lda puts
set result [ pg_exec $lda "set CLIENT_MIN_MESSAGES TO 'ERROR'" ]
pg_result $result -clear
Expand Down Expand Up @@ -3446,17 +3426,6 @@ switch $myposition {
return "$clientname:login failed:$message"
}
} else {
if {$tcl_platform(platform) == "windows"} {
#Workaround for Bug #95 where first connection fails on Windows
catch {pg_disconnect $lda}
if {[catch {set lda [pg_connect -conninfo [list host = $host port = $port sslmode = $sslmode user = $user password = $password dbname = $dbname ]]} message]} {
set lda "Failed"
if { $RAISEERROR } {
puts "$clientname:login failed:$message"
return "$clientname:login failed:$message"
}
}
}
if { $async_verbose } { puts "Connected $clientname:$lda" }
pg_notice_handler $lda puts
set result [ pg_exec $lda "set CLIENT_MIN_MESSAGES TO 'ERROR'" ]
Expand Down
5 changes: 0 additions & 5 deletions src/postgresql/pgotc.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,6 @@ proc tcount_pg {bm interval masterthread} {
if {[catch {set lda [pg_connect -conninfo [list host = $host port = $port sslmode = $sslmode user = $user password = $password dbname = $dbname ]]} message]} {
set lda "connection failed:$message"
} else {
if {$tcl_platform(platform) == "windows"} {
#Workaround for Bug #95 where first connection fails on Windows
catch {pg_disconnect $lda}
set lda [pg_connect -conninfo [list host = $host port = $port sslmode = $sslmode user = $user password = $password dbname = $dbname ]]
}
pg_notice_handler $lda puts
set result [ pg_exec $lda "set CLIENT_MIN_MESSAGES TO 'ERROR'" ]
pg_result $result -clear
Expand Down

0 comments on commit 595c938

Please sign in to comment.