Re: Mislabeled timestamp functions (was Re: [SQL] [NOVICE] date_trunc'd timestamp index possible?)

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Greg Stark <gsstark(at)mit(dot)edu>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Mislabeled timestamp functions (was Re: [SQL] [NOVICE] date_trunc'd timestamp index possible?)
Date: 2004-10-03 22:37:44
Message-ID: 9858.1096843064@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-novice pgsql-sql

Greg Stark <gsstark(at)mit(dot)edu> writes:
> Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> writes:
>> The reason the "char" arithmetic operators are dangerous is that they are
>> the only ones of those names in the STRING type category.

> What would happen if "char" were just removed from the STRING type category?

What other category would you put it in? The I/O behavior of "char"
is certainly not very conducive to thinking of it as storing integral
values, anyway.

> Or alternatively if it were broken out into two data types, "char" which
> didn't have these operators, and int1 which only had these operators and not
> all the string operators?

I don't have an objection in principle to an int1 datatype, but there
are a couple of practical objections; primarily that that looks way too
much like a new feature for this point in the 8.0 cycle. (I seem to
recall having once had concerns about unexpected side effects from
adding another set of overloaded operators to the NUMERIC category, too;
but I'm not sure if that's still relevant given the resolution-rule
changes we've made in the last couple releases.)

Even with an int1 datatype, I'm not sure it makes sense to provide
arithmetic operators specifically for the type, as opposed to providing
implicit coercions to "integer" and letting the actual arithmetic
happen at integer width.

regards, tom lane

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruno Wolff III 2004-10-03 23:29:42 Re: Checking for overflow of integer arithmetic
Previous Message David Fetter 2004-10-03 22:22:57 External Tabular Data Via SQL

Browse pgsql-novice by date

  From Date Subject
Next Message John DeSoi 2004-10-04 01:41:50 Re: Writing plpgsql not in a function (directly from plsql)?
Previous Message Greg Stark 2004-10-03 21:49:32 Re: Mislabeled timestamp functions (was Re: [SQL] [NOVICE] date_trunc'd timestamp index possible?)

Browse pgsql-sql by date

  From Date Subject
Next Message Bruno Wolff III 2004-10-03 23:42:43 Re: How to convert 3 colums to timestamp with timezone
Previous Message Greg Stark 2004-10-03 21:49:32 Re: Mislabeled timestamp functions (was Re: [SQL] [NOVICE] date_trunc'd timestamp index possible?)