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

[SQL] Need help: Find dirty rows, Update, Delete SQL

2006-02-18 Thread ogjunk-pgjedan
Hello, I need a bit of help with some SQL. I have two tables, call them Page and Bookmark. Each row in Page can have many Bookmarks pointing to it, and they are joined via a FK (Page.id = Bookmark.page_id). Page has a 'url' column: Page.url, which has a unique index on it. My Page.url column got

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