go-goracle/goracle

Commit using DBTIMEZONE if contains name, broke goracle in our case

artheus opened this issue · 2 comments

Describe the bug
After updating goracle as a dependency in our internal software, we were unable to start our application due to goracle reporting an error saying "empty timezone".

From what I can gather, this has to do with this commit: 2d97734

Debugging the application let me see that our Oracle database returns +01:00 for the dbTZ variable. timezone stays empty.

The ok variable will never be defined in our case, so therefore goracle will hit this error, no matter what we decide to do. Sorrily updating the database configuration is not an option here, for us.

We have to downgrade goracle to an older version.

To Reproduce

  1. use Oracle database with DBTIMEZONE value in DUAL schema, set to the format "+01:00".
  2. assert that LTRIM(REGEXP_SUBSTR(TO_CHAR(SYSTIMESTAMP), ' [^ ]+$')) from DUAL returns empty.
  3. Create a simple Go app using goracle to connect to said Oracle database, and run e.g. sql.Ping(). This should now return the confusing error "empty timezone"

Expected behavior

  • DBTIMEZONE formats like "+01:00", "UTC", etc should also be allowed.
  • Users should also be allowed to override this behaviour.

Your oracle client version
laptop:

Mon Aug 19 03:57:46 PDT 2019

Client Shared Library 64-bit - 19.3.0.0.0

System name:	Darwin
Release:	17.6.0
Version:	Darwin Kernel Version 17.6.0: Tue May  8 15:22:16 PDT 2018; root:xnu-4570.61.1~1/RELEASE_X86_64
Machine:	x86_64

server:

Thu Jun 28 10:53:06 UTC 2018

Client Shared Library 64-bit - 18.3.0.0.0

System name:    Linux
Release:        2.6.39-400.298.2.el6uek.x86_64
Version:        #1 SMP Mon Jan 22 13:13:37 PST 2018
Machine:        x86_64

Your goracle version
2.20.1

Your go version
go version go1.12.4 darwin/amd64

Your gcc version

Copyright (C) 2018 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.```

**Local Laptop**
 - OS: macos
 - Architecture x86_64
 - Version: 10.14.4 (18E226)

**Server**
 - OS: CentOS
 - Architecture x86_64
 - Version: 7.6.1810 (Core)

What does "SELECT SYSTIMESTAMP FROM DUAL" return?

Please try 43b173c and enhance TestCalculateTZ in conn_test.go with your configuration.