Re: date/time improvements for 7.2 - Mailing list pgsql-hackers

From Tom Lane
Subject Re: date/time improvements for 7.2
Date
Msg-id 9669.1003461197@sss.pgh.pa.us
Whole thread Raw
In response to date/time improvements for 7.2  (Thomas Lockhart <lockhart@fourpalms.org>)
List pgsql-hackers
Thomas Lockhart <lockhart@fourpalms.org> writes:
> Implement precision for the INTERVAL() type.
>  Use the typmod mechanism for both of INTERVAL features.

If I could figure out what the typmod of an interval type is defined
to be, I'd fix format_type() to display the type name properly so that
pg_dump would do the right thing.  But it doesn't seem very well
documented as to what the valid values are...

Also:

regression=# create table foo(f1 interval(6));
CREATE
regression=# insert into foo values ('1 hour');
ERROR:  AdjustIntervalForTypmod(): internal coding error

which I think is because
    if (range == MASK(YEAR))

should be
    else if (range == MASK(YEAR))

at line 384 of timestamp.c.

Also, you're going to have some problems with your plan to make
0xFFFF in the high bits mean "no range, but maybe a precision",
because there are a number of places that think that any typmod < 0
is a dummy.  I would strongly suggest that you arrange the coding
of interval's typmod to follow that convention, rather than assume
you can ignore it.  Perhaps use 0x7FFF (or zero...) to mean "no range",
and make sure none of the bits that are used are the sign bit?
        regards, tom lane


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: PQstatus() detect change in connection...
Next
From: Thomas Lockhart
Date:
Subject: Re: date/time improvements for 7.2