interval->day AdjustIntervalForTypmod?

From: Michael Glaesemann <grzm(at)myrealbox(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Subject: interval->day AdjustIntervalForTypmod?
Date: 2005-06-09 05:08:31
Message-ID: D96A7A51-3966-43AC-8FD8-2D950AA49883@myrealbox.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

I've been making a bit of progress on adding a day field to the
Interval struct (thanks to the help of this list and the find folks
on IRC). Selects and basic math seem to be working, and the code is
passing more regression tests than it was before.

I'm running into a bit of a problem with storing the data in
relations. For example:

test=# select '1 year 13 mons 2 days 26:03'::interval;
interval
-------------------------------
2 years 1 mon 2 days 26:03:00
(1 row)

test=# create table interval_tbl (f1 interval);
CREATE TABLE
test=# insert into interval_tbl (f1) values ('1 year 13 mons 2 days
26:03'::interval);
INSERT 0 1
test=# select * from interval_tbl;
f1
-----------------
2 days 26:03:00
(1 row)

It appears that the data isn't being stored properly. I think I need
to make adjustments to AdjustIntervalForTypmod() in timestamp.c, but
I could very easily be wrong. I'm unfamiliar with what this code is
supposed to do and typmods in general. I've searched the mailing
lists for hints but haven't found anything that has appeared
particularly helpful. Would someone be able to give me a bit of
background on typmod (and possibly related information) or suggest
where I might find more information?

Thanks for any assistance.

Michael Glaesemann
grzm myrealbox com

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Mark Kirkwood 2005-06-09 05:12:20 Re: pg_config --configure ...
Previous Message Alvaro Herrera 2005-06-09 04:38:55 Re: autovacuum in backend?