The Daily WTF: Curious Perversions in Information Technology
Welcome to TDWTF Forums Sign in | Join | Help
in Search

Sybase WTF

Last post 11-20-2008 10:58 PM by Weng. 20 replies.
Page 1 of 1 (21 items)
Sort Posts: Previous Next
  • 11-12-2008 9:54 PM

    Sybase WTF

    So, this morning one of the production DB's went down. The DBA's didn't tell us what happened, but it was down until sometime around lunch time.

    About 2 hours after everything had been restored to normal, I got a call from my boss, telling me that my app had barfed for unknown reasons. After checking out the appserver logs, I found this:

    </p><p>com.sybase.jdbc.SybSQLException: Arithmetic overflow during implicit conversion of NUMERIC value '1568316946041014268' to a NUMERIC field .
    </p><p>

    Shit. No way that field could get so high, it was around 1984 last time I checked. This was on an insert, and the overflowed field came from a related table. So I trace that value back to the source, and I find this "value" on the identity PK:

    50000000000000000000000000000002007

    Damn. That thing looks like either the GDP for every single country in the planet, or the US national debt. I don't even know how to read the damn number (50 million yotta-somethings?) and I'm pretty sure this is the problem. Sure enough, I find that this is way over the upper limit for a signed Long (64-bit integer) so we take action.

    The sad thing is that Sybase likes to do this whenever it goes down, and this identity had been already limited in its jump increments. This "jump" should've been in 10,000 increments, not ... whatever that number is.

    What irks me is that it isn't the only issue with this DBMS. PreparedStatements sometimes fail silently without any errors, or convert numbers to 0's. Urrrgh....

  • 11-12-2008 9:56 PM In reply to

    Re: Sybase WTF

    danixdefcon5:

    50000000000000000000000000000002007

    Damn. That thing looks like either the GDP for every single country in the planet, or the US national debt.

    Or the number of Pesos in a Dollar.  Or the number of Dollars in an Amero.

     

    Oh, and this should probably be in Sidebar, not GD. 

  • 11-13-2008 1:00 AM In reply to

    • tster
    • Top 10 Contributor
    • Joined on 04-11-2006
    • Natick, MA
    • Posts 1,765

    Re: Sybase WTF

    morbiuswilters:

    danixdefcon5:

    50000000000000000000000000000002007

    Damn. That thing looks like either the GDP for every single country in the planet, or the US national debt.

    Or the number of Pesos in a Dollar.  Or the number of Dollars in an Amero.

     

    Oh, and this should probably be in Sidebar, not GD. 

     

    it's obviously the number of fetish sites on the internet.

    The pig go. Go is to the fountain. The pig put foot. Grunt. Foot in what? ketchup. The dove fly. Fly is in sky. The dove drop something. The something on the pig. The pig disgusting... see bio for the earth shattering ending.
  • 11-13-2008 6:21 AM In reply to

    Re: Sybase WTF

    That's five septillion, two thousand and five.
  • 11-13-2008 6:54 AM In reply to

    • Zecc
    • Top 50 Contributor
    • Joined on 06-12-2007
    • Location, Location, Location
    • Posts 653

    Re: Sybase WTF

    Five-buncha-zeroes-two-thousand-and-seven.

    If mixed metaphors were illegal, I'd be having an indigestion.
    typeof NaN == 'number'
  • 11-13-2008 7:29 AM In reply to

    Re: Sybase WTF

    danixdefcon5:

    </p><p>com.sybase.jdbc.SybSQLException: Arithmetic overflow during implicit conversion of NUMERIC value '1568316946041014268' to a NUMERIC field .
    </p><p>

    Shit. No way that field could get so high, it was around 1984 last time I checked.

    Well, if it's been 24 years since you checked that field I'm not surprised it's higher than you thought...
    - Dan
  • 11-13-2008 7:57 AM In reply to

    • jpaull
    • Top 500 Contributor
    • Joined on 08-17-2007
    • Bristol, CT
    • Posts 58

    Re: Sybase WTF

    henke37:
    That's five septillion, two thousand and seven.

    FTFY

  • 11-13-2008 11:37 AM In reply to

    • Meh
    • Not Ranked
    • Joined on 02-01-2006
    • Posts 3

    Re: Sybase WTF

    Got to love IDENTITY BURNING SET FACTOR. What's really cool about it is that is specifies the percentage of the max ids to burn on restart. So if you have a numeric(20) and IDENTITY BURNING SET FACTOR at its minimum (0.01 IIRC), it would add 10^16 + 1 and insert it. So you have: 1 2 3 10000000000000001 10000000000000002 10000000000000003 20000000000000001 I've spent MANY hours fixing this. After the 3rd or 4th time it happened, I built a script to automatically backup, drop, and rebuild the tables. In the version 11 release we were using, there was no way to safely reset the identity counter without rebuilding the table. AWESOME. I will never willingly use Sybase again. I avoid MS SQL as well because of the common heritage. The page-level locks were a nice feature as well. Great for making an expensive server respond like a workstation. Also makes for easy deadlocks.
  • 11-13-2008 1:32 PM In reply to

    Re: Sybase WTF

    But MS SQL doesn't have any silly "features" like that.  Don't avoid it just because 10 years ago it had some of the same code as Sybase...

  • 11-13-2008 1:52 PM In reply to

    Re: Sybase WTF

     It could be worse...you could also be using PowerBuilder...

  • 11-13-2008 2:10 PM In reply to

    Re: Sybase WTF

    Meh:
    In the version 11 release we were using, there was no way to safely reset the identity counter without rebuilding the table. AWESOME.
    Guess what release we're using. You just described the DBA's "solution" to this problem. Of course, they also set the IDENTITY BURNING to some low value so it won't do these wild jumps. In theory.

    Meh:
    I will never willingly use Sybase again.
    I've been thinking that ever since I started working with this. Oh, and it shares the same lack of OFFSET/LIMIT support MSSQL has. (And still lacks, it seems MS doesn't seem to mind about that.)

    Meh:
    The page-level locks were a nice feature as well. Great for making an expensive server respond like a workstation. Also makes for easy deadlocks.
    The appserver's full of SQLExceptions stating deadlocks. Fortunately, most of my code uses tables that aren't shared with any other apps, and it seems my app doesn't do deadlock-prone stuff, even when used by many concurrent users.

  • 11-13-2008 4:01 PM In reply to

    • APH
    • Not Ranked
    • Joined on 06-08-2007
    • Posts 9

    Re: Sybase WTF

     

    Waldo2k2:

     It could be worse...you could also be using PowerBuilder...

    You know, our flagship product is written in it.... and I dread every day time I open the IDE. 

  • 11-13-2008 5:44 PM In reply to

    Re: Sybase WTF

    APH:
    You know, our flagship product is written in it.... and I dread every day time I open the IDE.
     

    Heh, ALL of our products are written in it (well, all but one). The only thing worse than the IDE itself, is using it alongside Visual Source Safe.

    Makes me want to commit Hari Kari with my keyboard.

  • 11-13-2008 7:45 PM In reply to

    • lolwtf
    • Top 100 Contributor
    • Joined on 04-02-2008
    • (null)
    • Posts 303

    Re: Sybase WTF

    It's OVER NINE THOUSAAAAAAND!
    (null)
  • 11-14-2008 7:18 AM In reply to

    Re: Sybase WTF

    danixdefcon5:
    it shares the same lack of OFFSET/LIMIT support MSSQL has. (And still lacks, it seems MS doesn't seem to mind about that.)
     

    [MS|T]-SQL has TOP. Less powerful than LIMIT, but it gets the same croppin' job done.

    But supporting LIMIT would prevent lots of ID NOT IN statements. :\

    — Flurp.
  • 11-14-2008 7:24 AM In reply to

    Re: Sybase WTF

    jpaull:

    henke37:
    That's fifty decillion, two thousand and seven.

    FTFY

    FTFY (assuming short scale, UK long scale version: fifty thousand quintillion, two thousand and seven, EU long scale version: fifty quintilliard, two thousand and seven)

  • 11-14-2008 7:36 AM In reply to

    Re: Sybase WTF

    dhromed:

    danixdefcon5:
    it shares the same lack of OFFSET/LIMIT support MSSQL has. (And still lacks, it seems MS doesn't seem to mind about that.)
     

    [MS|T]-SQL has TOP. Less powerful than LIMIT, but it gets the same croppin' job done.

    But supporting LIMIT would prevent lots of ID NOT IN statements. :\

     

    SQL 2005and later have ROW_NUMBER() OVER (Partition BY Field, Order By Field) and RANK() OVER (Partition BY Field, Order By Field) which can then be used in the where statement.  Both are much more powerful than LIMIT.

     

    “A system is a network of interdependent components that work together to try to accomplish the aim of the system. A system must have an aim. Without the aim, there is no system.”

    W. Edward Deming
  • 11-14-2008 7:55 AM In reply to

    Re: Sybase WTF

    lpope187:
    SQL 2005 and later have ROW_NUMBER() OVER (Partition BY Field, Order By Field) and RANK() OVER (Partition BY Field, Order By Field) which can then be used in the where statement.  Both are much more powerful than LIMIT.
     

    I am delighted and will invesitgate.

    — Flurp.
  • 11-20-2008 12:40 PM In reply to

    Re: Sybase WTF

    Meh:
    Got to love IDENTITY BURNING SET FACTOR. What's really cool about it is that is specifies the percentage of the max ids to burn on restart. So if you have a numeric(20) and IDENTITY BURNING SET FACTOR at its minimum (0.01 IIRC), it would add 10^16 + 1 and insert it.

    From the Sybase docs:

    "The default value, 5000, represents .05%, or .0005 [of the available keyspace]."

    Meh:
    After the 3rd or 4th time it happened, I built a script to automatically backup, drop, and rebuild the tables.

    From the same documentation, that's the best practice.

  • 11-20-2008 8:18 PM In reply to

    Re: Sybase WTF

    dhromed:

    danixdefcon5:
    it shares the same lack of OFFSET/LIMIT support MSSQL has. (And still lacks, it seems MS doesn't seem to mind about that.)
     

    [MS|T]-SQL has TOP. Less powerful than LIMIT, but it gets the same croppin' job done.

    But supporting LIMIT would prevent lots of ID NOT IN statements. :\

    So does Sybase. Still, lack of OFFSET does require WTF-worthy stuff to emulate that feature.

  • 11-20-2008 10:58 PM In reply to

    • Weng
    • Top 50 Contributor
    • Joined on 03-15-2008
    • Posts 506

    Re: Sybase WTF

    TwelveBaud:

    Meh:
    After the 3rd or 4th time it happened, I built a script to automatically backup, drop, and rebuild the tables.

    From the same documentation, that's the best practice.

    Which is TRWTF. That's NOT a fucking best practice, it's a fucking workaround hack.
Page 1 of 1 (21 items)
Powered by Community Server (Non-Commercial Edition), by Telligent Systems