pgsql: Add 'day' field to INTERVAL so 1 day interval can be

Started by Bruce Momjianalmost 21 years ago8 messagescomitters
Jump to latest
#1Bruce Momjian
bruce@momjian.us

Log Message:
-----------
Add 'day' field to INTERVAL so 1 day interval can be distinguished from
24 hours. This is very helpful for daylight savings time:

select '2005-05-03 00:00:00 EST'::timestamp with time zone + '24 hours';
?column?
----------------------
2005-05-04 01:00:00-04

select '2005-05-03 00:00:00 EST'::timestamp with time zone + '1 day';
?column?
----------------------
2005-05-04 01:00:00-04

Michael Glaesemann

Modified Files:
--------------
pgsql/doc/src/sgml:
func.sgml (r1.267 -> r1.268)
(http://developer.postgresql.org/cvsweb.cgi/pgsql/doc/src/sgml/func.sgml.diff?r1=1.267&r2=1.268)
pgsql/src/backend/commands:
variable.c (r1.109 -> r1.110)
(http://developer.postgresql.org/cvsweb.cgi/pgsql/src/backend/commands/variable.c.diff?r1=1.109&r2=1.110)
pgsql/src/backend/utils/adt:
date.c (r1.112 -> r1.113)
(http://developer.postgresql.org/cvsweb.cgi/pgsql/src/backend/utils/adt/date.c.diff?r1=1.112&r2=1.113)
formatting.c (r1.90 -> r1.91)
(http://developer.postgresql.org/cvsweb.cgi/pgsql/src/backend/utils/adt/formatting.c.diff?r1=1.90&r2=1.91)
nabstime.c (r1.135 -> r1.136)
(http://developer.postgresql.org/cvsweb.cgi/pgsql/src/backend/utils/adt/nabstime.c.diff?r1=1.135&r2=1.136)
selfuncs.c (r1.184 -> r1.185)
(http://developer.postgresql.org/cvsweb.cgi/pgsql/src/backend/utils/adt/selfuncs.c.diff?r1=1.184&r2=1.185)
timestamp.c (r1.133 -> r1.134)
(http://developer.postgresql.org/cvsweb.cgi/pgsql/src/backend/utils/adt/timestamp.c.diff?r1=1.133&r2=1.134)
pgsql/src/include/catalog:
pg_proc.h (r1.376 -> r1.377)
(http://developer.postgresql.org/cvsweb.cgi/pgsql/src/include/catalog/pg_proc.h.diff?r1=1.376&r2=1.377)
pg_type.h (r1.163 -> r1.164)
(http://developer.postgresql.org/cvsweb.cgi/pgsql/src/include/catalog/pg_type.h.diff?r1=1.163&r2=1.164)
pgsql/src/include/utils:
timestamp.h (r1.46 -> r1.47)
(http://developer.postgresql.org/cvsweb.cgi/pgsql/src/include/utils/timestamp.h.diff?r1=1.46&r2=1.47)
pgsql/src/interfaces/ecpg/pgtypeslib:
interval.c (r1.23 -> r1.24)
(http://developer.postgresql.org/cvsweb.cgi/pgsql/src/interfaces/ecpg/pgtypeslib/interval.c.diff?r1=1.23&r2=1.24)
pgsql/src/test/regress/expected:
interval.out (r1.11 -> r1.12)
(http://developer.postgresql.org/cvsweb.cgi/pgsql/src/test/regress/expected/interval.out.diff?r1=1.11&r2=1.12)

#2Bruce Momjian
bruce@momjian.us
In reply to: Bruce Momjian (#1)
Re: pgsql: Add 'day' field to INTERVAL so 1 day interval

Bruce Momjian wrote:

Log Message:
-----------
Add 'day' field to INTERVAL so 1 day interval can be distinguished from
24 hours. This is very helpful for daylight savings time:

select '2005-05-03 00:00:00 EST'::timestamp with time zone + '24 hours';
?column?
----------------------
2005-05-04 01:00:00-04

select '2005-05-03 00:00:00 EST'::timestamp with time zone + '1 day';
?column?
----------------------
2005-05-04 01:00:00-04

Oops, meant:

SELECT '2005-04-03 00:00:00'::timestamp WITH TIME ZONE + '1 day';
?column?
------------------------
2005-04-04 00:00:00-04

SELECT '2005-04-03 00:00:00'::timestamp WITH TIME ZONE + '24 hours';
?column?
------------------------
2005-04-04 01:00:00-04

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073
#3Tom Lane
tgl@sss.pgh.pa.us
In reply to: Bruce Momjian (#1)
Re: pgsql: Add 'day' field to INTERVAL so 1 day interval can be

momjian@svr1.postgresql.org (Bruce Momjian) writes:

Add 'day' field to INTERVAL so 1 day interval can be distinguished from
24 hours. This is very helpful for daylight savings time:

Surely this patch should have forced initdb.

regards, tom lane

#4Bruce Momjian
bruce@momjian.us
In reply to: Tom Lane (#3)
Re: pgsql: Add 'day' field to INTERVAL so 1 day interval

Tom Lane wrote:

momjian@svr1.postgresql.org (Bruce Momjian) writes:

Add 'day' field to INTERVAL so 1 day interval can be distinguished from
24 hours. This is very helpful for daylight savings time:

Surely this patch should have forced initdb.

Thanks, done. He originally had the catversion but I worked on the
patch for so long I forgot about it.

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073
#5Kris Jurka
books@ejurka.com
In reply to: Bruce Momjian (#1)
Re: pgsql: Add 'day' field to INTERVAL so 1 day interval can be

Bruce Momjian wrote:

Log Message:
-----------
Add 'day' field to INTERVAL so 1 day interval can be distinguished from
24 hours. This is very helpful for daylight savings time:

Seems to have broken the contrib/btree_gist interval regression tests

http://pgbuildfarm.org/cgi-bin/show_log.pl?nm=dragonfly&dt=2005-07-20%2017:30:00

Kris Jurka

#6Bruce Momjian
bruce@momjian.us
In reply to: Kris Jurka (#5)
Re: pgsql: Add 'day' field to INTERVAL so 1 day interval

Kris Jurka wrote:

Bruce Momjian wrote:

Log Message:
-----------
Add 'day' field to INTERVAL so 1 day interval can be distinguished from
24 hours. This is very helpful for daylight savings time:

Seems to have broken the contrib/btree_gist interval regression tests

http://pgbuildfarm.org/cgi-bin/show_log.pl?nm=dragonfly&dt=2005-07-20%2017:30:00

I am looking at that now. I never checked contrib for Interval
references.

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073
#7Bruce Momjian
bruce@momjian.us
In reply to: Kris Jurka (#5)
Re: [COMMITTERS] pgsql: Add 'day' field to INTERVAL so 1 day interval

Kris Jurka wrote:

Bruce Momjian wrote:

Log Message:
-----------
Add 'day' field to INTERVAL so 1 day interval can be distinguished from
24 hours. This is very helpful for daylight savings time:

Seems to have broken the contrib/btree_gist interval regression tests

http://pgbuildfarm.org/cgi-bin/show_log.pl?nm=dragonfly&dt=2005-07-20%2017:30:00

I have applied a patch which adds the 'date' value for interval to the
code. However, the regression still does not pass. Here is a query:

SELECT count(*) FROM intervaltmp WHERE a = '199 days 21:21:23'::interval;
count
-------
1
(1 row)

that should return 1, but returns 0 in the current code. Does anyone
have any ideas on a fix?

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073
#8Bruce Momjian
bruce@momjian.us
In reply to: Kris Jurka (#5)
Re: pgsql: Add 'day' field to INTERVAL so 1 day interval

Kris Jurka wrote:

Bruce Momjian wrote:

Log Message:
-----------
Add 'day' field to INTERVAL so 1 day interval can be distinguished from
24 hours. This is very helpful for daylight savings time:

Seems to have broken the contrib/btree_gist interval regression tests

http://pgbuildfarm.org/cgi-bin/show_log.pl?nm=dragonfly&dt=2005-07-20%2017:30:00

Tom found the problem --- the storage size need to be updated in the
SQL, which I didn't check. The build farm should pass now.

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073