Skip to content

Commit 7e477c0

Browse files
committed
fix(oracle): use view available for all users for driver.Version
Use v$version instead of v$instance because it is available to all users. Like v$instance, v$version is available in all oracle versions from the past 20+ years. Typical Version() output is "Oracle Database 21c Express Edition Release 21.0.0.0.0 - Production" Testing Done: Oracle Express 21c and 11g For 11g: docker run -d -p 1521:1521 -e ORACLE_PASSWORD=foobar gvenzl/oracle-xe:11-slim ./usql oracle://sys:foobar@localhost/xe # version is shown correctly create user test identified by test; GRANT CREATE SESSION to test; \connect oracle://test:test@localhost/xe # version is still shown correctly, despite minimal privileges 21c in the issue was also tested that way.
1 parent ce82ecc commit 7e477c0

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/oracle/orshared/orshared.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,10 @@ func Register(name string, err func(error) (string, string), isPasswordErr func(
3737
},
3838
Version: func(ctx context.Context, db drivers.DB) (string, error) {
3939
var ver string
40-
if err := db.QueryRowContext(ctx, `SELECT version FROM v$instance`).Scan(&ver); err != nil {
40+
if err := db.QueryRowContext(ctx, `SELECT banner FROM v$version`).Scan(&ver); err != nil {
4141
return "", err
4242
}
43-
return "Oracle Database " + ver, nil
43+
return ver, nil
4444
},
4545
User: func(ctx context.Context, db drivers.DB) (string, error) {
4646
var user string

0 commit comments

Comments
 (0)