Re: pg_attribute.atttypmod for interval type

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Greg Rychlewski <greg(dot)rychlewski(at)gmail(dot)com>
Cc: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: pg_attribute.atttypmod for interval type
Date: 2024-07-27 04:32:25
Message-ID: 1913262.1722054745@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Greg Rychlewski <greg(dot)rychlewski(at)gmail(dot)com> writes:
> My question is: how are the values meant to be interpreted for interval
> types? Thanks very much for your help.

Interval typmods include a fractional-seconds-precision field as well
as a bitmask indicating the allowed interval fields (per the SQL
standard's weird syntax such as INTERVAL DAY TO SECOND). Looking at
the source code for intervaltypmodout() might be helpful:

https://git.postgresql.org/gitweb/?p=postgresql.git;a=blob;f=src/backend/utils/adt/timestamp.c;h=69fe7860ede062fc8be42e7545b35e69c3e068c4;hb=HEAD#l1136

The referenced macros are mostly in utils/timestamp.h and
utils/datetime.h.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tatsuo Ishii 2024-07-27 05:55:04 Re: Protocol question regarding Portal vs Cursor
Previous Message Greg Rychlewski 2024-07-27 03:57:24 pg_attribute.atttypmod for interval type