Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 5 of 5 total
Thread 1.02 b1 - interval issues
Thu, Apr 12 2007 12:45 PMPermanent Link

"Ole Willy Tuv"
select
 cast((current_date-date'2000-01-01') as integer) issue1,
 cast((current_date-timestamp'2000-01-01 00:00:00') year as integer) issue2
from dummy

Issue1:

EDB executes the ambiguous expression (current_date-date'2000-01-01')
without a complaint and returns a DAY interval. Since the result of
subtracting a datetime value from a datetime value can be any valid
interval, an interval qualifier is required in such expressions.

The correct syntax is:

( <datetime value expression> - <datetime term> ) <interval qualifier>

Valid intervals when casted to integer would be any single field interval:

YEAR
MONTH
DAY
HOUR
MINUTE
SECOND
MSECOND (EDB extension)

Issue2:

The expression (current_date-timestamp'2000-01-01 00:00:00') is invalid,
since the the two operands are not comparable (they have different datetime
fields). EDB executes the expression without a complaint, but returns the
null value. The engine should raise a proper exception here.

Ole Willy Tuv

Thu, Apr 12 2007 3:45 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Ole,

<< EDB executes the ambiguous expression (current_date-date'2000-01-01')
without a complaint and returns a DAY interval. Since the result of
subtracting a datetime value from a datetime value can be any valid
interval, an interval qualifier is required in such expressions. >>

This is intentional to make it easier for DBISAM migration.

<< The expression (current_date-timestamp'2000-01-01 00:00:00') is invalid,
since the the two operands are not comparable (they have different datetime
fields). EDB executes the expression without a complaint, but returns the
null value. The engine should raise a proper exception here. >>

I'm checking this one out this evening.

--
Tim Young
Elevate Software
www.elevatesoft.com

Thu, Apr 12 2007 3:50 PMPermanent Link

"Ole Willy Tuv"
Tim,

<< I'm checking this one out this evening. >>

I understand, but it doesn't make the expression less ambiguous.

I think you'll be better off in the end by removing this kind of ambiguity
from EDB.

Ole Willy Tuv

Thu, Apr 12 2007 4:40 PMPermanent Link

"Ole Willy Tuv"
Tim,

<<< I'm checking this one out this evening. >>>

<< I understand, but it doesn't make the expression less ambiguous. >>

Sorry, I quoted the wrong part of your post.

I was actually responding to:

<<This is intentional to make it easier for DBISAM migration.>>

Ole Willy Tuv

Sat, Apr 14 2007 3:37 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Ole,

<< Sorry, I quoted the wrong part of your post. >>

I knew what you meant. Smiley

--
Tim Young
Elevate Software
www.elevatesoft.com

Image