Re: date/time improvements for 7.2

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: date/time improvements for 7.2
Дата
Msg-id 9669.1003461197@sss.pgh.pa.us
обсуждение исходный текст
Ответ на date/time improvements for 7.2  (Thomas Lockhart <lockhart@fourpalms.org>)
Список 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 по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: PQstatus() detect change in connection...
Следующее
От: Thomas Lockhart
Дата:
Сообщение: Re: date/time improvements for 7.2