FAQ
When you create a column with a plain "interval" column, the typmod is
set to -1 and the information schema reports this as 6, because that's
what the internal default value is (see _pg_datetime_precision
function). But when you create a column such as "interval year to
month"), the typmod is actually the bit encoding of "year to month" in
the higher 16 bits and 65535 in the lower 16 bits, and so the
information schema reports the precision as 65535, whereas the actual
behavior still corresponds to a precision of 6.

I guess this could be seen as a reporting issue. We could adjust
_pg_datetime_precision to map 65535 to 6, just like -1 is mapped to 6.
Or is there anything else wrong here?

Search Discussions

  • Tom Lane at Jul 12, 2011 at 10:45 pm

    Peter Eisentraut writes:
    When you create a column with a plain "interval" column, the typmod is
    set to -1 and the information schema reports this as 6, because that's
    what the internal default value is (see _pg_datetime_precision
    function). But when you create a column such as "interval year to
    month"), the typmod is actually the bit encoding of "year to month" in
    the higher 16 bits and 65535 in the lower 16 bits, and so the
    information schema reports the precision as 65535, whereas the actual
    behavior still corresponds to a precision of 6.
    I guess this could be seen as a reporting issue. We could adjust
    _pg_datetime_precision to map 65535 to 6, just like -1 is mapped to 6.
    Or is there anything else wrong here?
    No, it sounds like the information_schema function didn't get the memo
    about what that meant. See INTERVAL_FULL_RANGE, INTERVAL_FULL_PRECISION
    macros and usage thereof, esp. intervaltypmodout.

    regards, tom lane

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppgsql-hackers @
categoriespostgresql
postedJul 12, '11 at 10:22p
activeJul 12, '11 at 10:45p
posts2
users2
websitepostgresql.org...
irc#postgresql

2 users in discussion

Peter Eisentraut: 1 post Tom Lane: 1 post

People

Translate

site design / logo © 2023 Grokbase