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

For TPC-H on Postgres, connection to database fails #400

Closed
prasantaghosh opened this issue Aug 3, 2022 · 1 comment · Fixed by #402
Closed

For TPC-H on Postgres, connection to database fails #400

prasantaghosh opened this issue Aug 3, 2022 · 1 comment · Fixed by #402
Assignees
Labels
bug Something isn't working

Comments

@prasantaghosh
Copy link

I see some potential bug, but it may not be one I am hitting…

You see ‘port sslmode = $port’, the sslmode should not be there…

In pgolap.tcl,

785 } else {
786 if {$tcl_platform(platform) == "windows"} {
787 #Workaround for Bug #95 where first connection fails on Windows
788 catch {pg_disconnect $lda}
789 set lda [pg_connect -conninfo [list host = $host port sslmode = $port sslmode = $sslmode user = $user password = $password dbname = $dbname ]]

Here are the steps…
dbset db pg
dbset bm TPC-H
loadscript
vucreate
vurun

HammerDB CLI v4.5
Copyright (C) 2003-2022 Steve Shaw
Type "help" for a list of commands
hammerdb>
Database set to PostgreSQL

hammerdb>dbset bm TPC-H
Benchmark set to TPC-H for PostgreSQL

hammerdb>loadscript
TPROC-H Driver Script
Script loaded, Type "print script" to view

hammerdb>vucreate
Vuser 1 created - WAIT IDLE
1 Virtual Users Created

hammerdb>vurun
Vuser 1:RUNNING
Error in Virtual User 1: Connection to database failed
missing "=" after "port" in connection info string

@sm-shaw
Copy link
Contributor

sm-shaw commented Aug 4, 2022

Hi,

I have verified and yes this is a bug that impacts the PostgreSQL TPROC-H driver script only on Windows. So as you rightly identify there is an additional sslmode in the connect string between port = $port that should not be there.

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 ]]
}

and this results in the error

Error in Virtual User 1: Connection to database failed
missing "=" after "port" in connection info string

when trying to run the driver script.
As a workaround, you can delete the additional sslmode word highlight above.
However, this additional section was itself also added as a bug workaround and testing on PostgreSQL 12 for windows shows it is no longer required. (The first connection attempt will have succeeded and then disconnected to get to this point) Therefore a pull request will be made to remove this entire section for both TPROC-C and H.

proc ConnectToPostgres { host port sslmode user password dbname } {
    global tcl_platform
    if {[catch {set lda [pg_connect -conninfo [list host = $host port = $port sslmode = $sslmode user = $user password = $password dbname = $dbname ]]} message]} {
        set lda "Failed" ; puts $message
        error $message
    } else {
        pg_notice_handler $lda puts
        set result [ pg_exec $lda "set CLIENT_MIN_MESSAGES TO 'ERROR'" ]
        pg_result $result -clear
    }
    return $lda
}

@sm-shaw sm-shaw self-assigned this Aug 4, 2022
@sm-shaw sm-shaw added the bug Something isn't working label Aug 4, 2022
@sm-shaw sm-shaw linked a pull request Aug 4, 2022 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants