It's good to hear this kind of discussion going on!

I solved my problem (for now) by creating a bunch of
overloaded LEAST and GREATEST functions, one for each
datatype.  They only take two parameters, but that's
fine for what we're doing.

However, I ran into another, unrelated problem.  I
created the LEAST and GREATEST functions as described
above, but when I tried to perform an update statement
comparing two timestamps, I ran into a problem:

UPDATE foo
  SET my_timestamp_field =
      LEAST(my_timestamp_field,
            TO_TIMESTAMP('2003-07-01 12:34:56',
'YYYY-MM-DD HH24:MI:SS'))
  WHERE ...

My LEAST function would not work because
my_timestamp_field has a datatype of "timestamp
without time zone", and the TO_TIMESTAMP(...) creates
a "timestamp *with* time zone".  I could not find
anything in the documentation about this behavior.  I
am running v7.3.2.

All help is appreciated, and please keep up the
discussion about the ability to create functions with
variable number of arguments (LEAST, GREATEST, etc.). 
I could see the potential for wanting to write these
in the future.

Cheers,

-Stefan


__________________________________
Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month!
http://sbc.yahoo.com

---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
    (send "unregister YourEmailAddressHere" to [EMAIL PROTECTED])

Reply via email to