Re: [HACKERS] [SQL] Interval subtracting

2006-03-08 Thread PFC
For same reasons, i.e. a need for precision, I find it hard to accept the idea of mixing positive and negative units in the same interval. The plus or minus sign should be outside of the interval. The interval data type is really useful. I see no reason to restrict its usefulness with an ar

Re: [HACKERS] [SQL] Interval subtracting

2006-03-08 Thread Tom Lane
Scott Marlowe <[EMAIL PROTECTED]> writes: > For same reasons, i.e. a need for precision, I find it hard to accept > the idea of mixing positive and negative units in the same interval. The semantics are perfectly well defined, so I don't buy this. regards, tom lane -

Re: [HACKERS] [SQL] Interval subtracting

2006-03-08 Thread Scott Marlowe
On Wed, 2006-03-08 at 06:07, Markus Schaber wrote: > Hi, Scott, > > Scott Marlowe wrote: > > >>But it isn't '-2 months, -1 day'. I think what you are saying is what I > >>am saying, that we should make the signs consistent. > > Pretty much. It just seems wrong to have different signs in what is

Re: [HACKERS] [SQL] Interval subtracting

2006-03-08 Thread Markus Schaber
Hi, Scott, Scott Marlowe wrote: >>But it isn't '-2 months, -1 day'. I think what you are saying is what I >>am saying, that we should make the signs consistent. > Pretty much. It just seems wrong to have different signs in what is > essentially a single unit. > > We don't say 42 degrees, -12 m

Re: [HACKERS] [SQL] Interval subtracting

2006-03-01 Thread Scott Marlowe
On Wed, 2006-03-01 at 14:27, Bruce Momjian wrote: > Scott Marlowe wrote: > > On Wed, 2006-03-01 at 14:18, Bruce Momjian wrote: > > > Stephan Szabo wrote: > > > > > justify_days doesn't currently do anything with this result --- it > > > > > thinks its charter is only to reduce day components that a

Re: [HACKERS] [SQL] Interval subtracting

2006-03-01 Thread Tom Lane
Hannu Krosing <[EMAIL PROTECTED]> writes: > But unfortunately '2 mons -1 days' <> '1 mons 29 days' > If I want something to happen 1 day less than two months from dome date, > then the only way to say that consistently *is* '2 mons -1 days'. Sure, but if you want to represent that then you don't p

Re: [HACKERS] [SQL] Interval subtracting

2006-03-01 Thread Bruce Momjian
Hannu Krosing wrote: > ?hel kenal p?eval, K, 2006-03-01 kell 15:18, kirjutas Bruce Momjian: > > Stephan Szabo wrote: > > > > justify_days doesn't currently do anything with this result --- it > > > > thinks its charter is only to reduce day components that are >= 30 days. > > > > However, I think a

Re: [HACKERS] [SQL] Interval subtracting

2006-03-01 Thread Stephan Szabo
On Wed, 1 Mar 2006, Hannu Krosing wrote: > Ühel kenal päeval, K, 2006-03-01 kell 15:18, kirjutas Bruce Momjian: > > Stephan Szabo wrote: > > > > justify_days doesn't currently do anything with this result --- it > > > > thinks its charter is only to reduce day components that are >= 30 days. > > >

Re: [HACKERS] [SQL] Interval subtracting

2006-03-01 Thread Bruce Momjian
Scott Marlowe wrote: > On Wed, 2006-03-01 at 14:18, Bruce Momjian wrote: > > Stephan Szabo wrote: > > > > justify_days doesn't currently do anything with this result --- it > > > > thinks its charter is only to reduce day components that are >= 30 days. > > > > However, I think a good case could be

Re: [SQL] Interval subtracting

2006-03-01 Thread Scott Marlowe
On Wed, 2006-03-01 at 14:18, Bruce Momjian wrote: > Stephan Szabo wrote: > > > justify_days doesn't currently do anything with this result --- it > > > thinks its charter is only to reduce day components that are >= 30 days. > > > However, I think a good case could be made that it should normalize

Re: [SQL] Interval subtracting

2006-03-01 Thread Bruce Momjian
Stephan Szabo wrote: > > justify_days doesn't currently do anything with this result --- it > > thinks its charter is only to reduce day components that are >= 30 days. > > However, I think a good case could be made that it should normalize > > negative days too; that is, the invariant on its resul

Re: [SQL] Interval subtracting

2006-02-20 Thread Milorad Poluga
Thank you all for suggestions and links. Currently, I am working on  PostgreSQL 8.0.4., so I cannot use justify_*() functions. Regards, Milorad Poluga [EMAIL PROTECTED] ---(end of broadcast)--- TIP 3: Have you checked our extensive FAQ?

Re: [SQL] Interval subtracting

2006-02-18 Thread Stephan Szabo
On Sat, 18 Feb 2006, Tom Lane wrote: > "Milen A. Radev" <[EMAIL PROTECTED]> writes: > > Milorad Poluga : > >>> SELECT '10 years 1 mons 1 days'::interval - '9 years 10 mons 15 > >>> days'::interval > >>> ?column? > >>> --- > >>> 3 mons -14 days > >>> > >>> Why not '2 mons

Re: [SQL] Interval subtracting

2006-02-18 Thread Tom Lane
"Milen A. Radev" <[EMAIL PROTECTED]> writes: > Milorad Poluga написа: >>> SELECT '10 years 1 mons 1 days'::interval - '9 years 10 mons 15 >>> days'::interval >>> ?column? >>> --- >>> 3 mons -14 days >>> >>> Why not '2 mons 16 days' ? > Please read the last paragraph

Re: [SQL] Interval subtracting

2006-02-18 Thread Milen A. Radev
Milorad Poluga написа: > On Saturday 18 February 2006 15:24, Milen A. Radev wrote: >> Milorad Poluga написа: >>> Hi all, >>> >>> Is there something incorrect in the above query ? >>> SELECT '10 years 1 mons 1 days'::interval - '9 years 10 mons 15 >>> days'::interval >>> >>> ?column? >>>

Re: [SQL] Interval subtracting

2006-02-18 Thread Milorad Poluga
On Saturday 18 February 2006 15:24, Milen A. Radev wrote: > Milorad Poluga написа: > > Hi all, > > > > Is there something incorrect in the above query ? > > SELECT '10 years 1 mons 1 days'::interval - '9 years 10 mons 15 > > days'::interval > > > > ?column? > > --- > > 3

Re: [SQL] Interval subtracting

2006-02-18 Thread Milen A. Radev
Milorad Poluga написа: Hi all, Is there something incorrect in the above query ? SELECT '10 years 1 mons 1 days'::interval - '9 years 10 mons 15 days'::interval ?column? --- 3 mons -14 days Why not '2 mons 16 days' ? /version = PostgreSQL 8.0.4 on i686-pc-linux-

[SQL] Interval subtracting

2006-02-18 Thread Milorad Poluga
Hi all, Is there something incorrect in the above query ? SELECT '10 years 1 mons 1 days'::interval - '9 years 10 mons 15 days'::interval ?column? --- 3 mons -14 days Why not '2 mons 16 days' ? /version = PostgreSQL 8.0.4 on i686-pc-linux-gnu, compiled by GCC gcc (G