2008/5/1 H. Harada <umi.tanuki@[EMAIL PROTECTED]
>:
> 2008/5/1 Pavel Stehule <pavel.stehule@[EMAIL PROTECTED]
>:
>
> > Hello
> >
> > why you don't use polymorphic types?
> Ah, good idea. I didn't think we could fix the third argument to
> "interval" but "anyelement".
> For a tem****al version, it's reasonable.
I was thinking about it again. There are 3 points:
a. It will get complicated in the function to resolve operator for
polymorphic types, including search for namespace and error (not
found) handling.
b. Other tem****al data types than timestamp is easy to be casted from
timestamp results.
c. In the integer version of generate_series also it is possible to
cast the results to other numerical types though harder to cast them
to tem****al data types.
So it would be better to keep current patch, isn't it?
postgres=3D# select generate_series('2008/05/01 20:00'::timestamp,
'2008/05/02 08:00'::timestamp
, '1 hour'::interval);
generate_series
---------------------
2008-05-01 20:00:00
2008-05-01 21:00:00
2008-05-01 22:00:00
2008-05-01 23:00:00
2008-05-02 00:00:00
2008-05-02 01:00:00
2008-05-02 02:00:00
2008-05-02 03:00:00
2008-05-02 04:00:00
2008-05-02 05:00:00
2008-05-02 06:00:00
2008-05-02 07:00:00
2008-05-02 08:00:00
(13 rows)
postgres=3D# select generate_series('2008/05/01 20:00'::timestamp,
'2008/05/02 08:00'::timestamp
, '1 hour'::interval)::time;
generate_series
-----------------
20:00:00
21:00:00
22:00:00
23:00:00
00:00:00
01:00:00
02:00:00
03:00:00
04:00:00
05:00:00
06:00:00
07:00:00
08:00:00
(13 rows)
postgres=3D# select generate_series('2008/05/01 20:00'::timestamp,
'2008/05/02 08:00'::timestamp
, '1 hour'::interval)::timestamptz;
generate_series
------------------------
2008-05-01 20:00:00+09
2008-05-01 21:00:00+09
2008-05-01 22:00:00+09
2008-05-01 23:00:00+09
2008-05-02 00:00:00+09
2008-05-02 01:00:00+09
2008-05-02 02:00:00+09
2008-05-02 03:00:00+09
2008-05-02 04:00:00+09
2008-05-02 05:00:00+09
2008-05-02 06:00:00+09
2008-05-02 07:00:00+09
2008-05-02 08:00:00+09
(13 rows)
postgres=3D# select generate_series('2008/05/01 20:00'::timestamp,
'2008/05/02 08:00'::timestamp
, '1 hour'::interval)::date;
generate_series
-----------------
2008-05-01
2008-05-01
2008-05-01
2008-05-01
2008-05-02
2008-05-02
2008-05-02
2008-05-02
2008-05-02
2008-05-02
2008-05-02
2008-05-02
2008-05-02
(13 rows)
Hito**** Harada
2008/5/1 H. Harada <umi.tanuki@[EMAIL PROTECTED]
>:
> 2008/5/1 Pavel Stehule <pavel.stehule@[EMAIL PROTECTED]
>:
>
> > Hello
> >
> > why you don't use polymorphic types?
> Ah, good idea. I didn't think we could fix the third argument to
> "interval" but "anyelement".
> For a tem****al version, it's reasonable.
>
> Also, the name "generate_time_series" is better than before?
>
> Hito**** Harada
>
>
> 2008/5/1 Pavel Stehule <pavel.stehule@[EMAIL PROTECTED]
>:
>
>
> > Hello
> >
> > why you don't use polymorphic types?
> >
> > like:
> >
> > create or replace function generate_time_series(anyelement,
> > anyelement, interval, OUT result anyelement)
> > returns setof anyelement as $$
> > begin
> > result :=3D $1;
> > while (result <=3D $2) loop
> > return next;
> > result :=3D result + $3;
> > end loop;
> > return;
> > end;
> > $$ language plpgsql;
> >
> > Regards
> > Pavel Stehule
> >
> >
> >
> > 2008/5/1 H. Harada <umi.tanuki@[EMAIL PROTECTED]
>:
> >
> >
> > > Here's the sync and updated patch.
> > > It contains "strict" in catalog as well.
> > >
> > > Hito**** Harada
> > >
> > > 2008/4/24 H. Harada <umi.tanuki@[EMAIL PROTECTED]
>:
> > >> 2008/4/23 Alvaro Herrera <alvherre@[EMAIL PROTECTED]
>:
> > >>
> > >> > H.Harada escribi=F3:
> > >> >
> > >> >
> > >> > > # This is my first time to send a patch. If I did something
=
wrong, I
> > >> > > appreciate your pointing me out.
> > >> >
> > >> > Brace positioning is off w.r.t. our conventions -- please fix
=
that and
> > >> > resubmit.
> > >>
> > >> Here's updated version. Thanks for your advice.
> > >>
> > >> Hito**** Harada
> > >>
> > >> 2008/4/23 Alvaro Herrera <alvherre@[EMAIL PROTECTED]
>:
> > >>
> > >>
> > >> > H.Harada escribi=F3:
> > >> >
> > >> >
> > >> > > # This is my first time to send a patch. If I did something
=
wrong, I
> > >> > > appreciate your pointing me out.
> > >> >
> > >> > Brace positioning is off w.r.t. our conventions -- please fix
=
that and
> > >> > resubmit.
> > >> >
> > >> > I have added this patch to the May commitfest.
> > >> >
> > >> > --
> > >> > Alvaro Herrera
http://www.Comma=
ndPrompt.com/
> > >> > The PostgreSQL Company - Command Prompt, Inc.
> > >> >
> > >>
> > >
> > >
> > > --
> > > Sent via pgsql-patches mailing list (pgsql-patches@[EMAIL PROTECTED]
)
> > > To make changes to your subscription:
> > > http://www.postgresql.org/mailpref/pgsql-patches
> > >
> > >
> >
>
--=20
Sent via pgsql-patches mailing list (pgsql-patches@[EMAIL PROTECTED]
)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-patches


|