From middink@indo.net.id Fri Dec 10 22:51:44 2004 X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 6600D3A67C6 for ; Fri, 10 Dec 2004 22:51:44 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 10051-04 for ; Fri, 10 Dec 2004 22:50:53 +0000 (GMT) Received: from www.postgresql.com (unknown [200.46.204.209]) by svr1.postgresql.org (Postfix) with ESMTP id 1DBE93A6A41 for ; Fri, 10 Dec 2004 19:28:50 +0000 (GMT) Received: from smtp-1.indo.net.id (smtp-1.indo.net.id [202.159.32.91]) by www.postgresql.com (Postfix) with SMTP id DF2D3738703 for ; Fri, 10 Dec 2004 19:28:09 +0000 (GMT) Received: (qmail 21742 invoked from network); 11 Dec 2004 02:27:33 +0700 Received: from smtp.indo.net.id (202.159.32.81) by smtp-1.indo.net.id with SMTP; 11 Dec 2004 02:27:33 +0700 Received: (qmail 10381 invoked from network); 11 Dec 2004 02:27:32 +0700 Received: from unknown (HELO middinks) (202.159.122.122) by smtp.indo.net.id with SMTP; 11 Dec 2004 02:27:32 +0700 Message-ID: <003801c4deee$451eb6c0$1f00a8c0@middinks> From: "Muhyiddin A.M Hayat" To: Subject: Create Calendar Date: Sat, 11 Dec 2004 03:26:33 +0800 MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_0033_01C4DF31.367E1280" X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2900.2180 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.001 tagged_above=0 required=5 tests=HTML_MESSAGE X-Spam-Level: X-Archive-Number: 200412/49 X-Sequence-Number: 19669 This is a multi-part message in MIME format. ------=_NextPart_000_0033_01C4DF31.367E1280 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Dear All, How to create Calendar using Function/View.=20 For example i would like to display date 2004-12-01 to 2004-12-20.=20 date ------ 2004-12-01=20 2004-12-02=20 2004-12-03=20 2004-12-04=20 2004-12-05 .................. ..................=20 2004-12-20 ------=_NextPart_000_0033_01C4DF31.367E1280 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
Dear All,
 
How to create Calendar using = Function/View.=20
For example i would like to display = date 2004-12-01=20 to 2004-12-20.
 
date
------
2004-12-01
2004-12-02
2004-12-03
2004-12-04
2004-12-05
..................
.................. 
2004-12-20
------=_NextPart_000_0033_01C4DF31.367E1280-- From mike@fuhr.org Sat Dec 11 04:27:55 2004 X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id C52583A6392 for ; Sat, 11 Dec 2004 04:27:55 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 10851-08 for ; Sat, 11 Dec 2004 04:27:45 +0000 (GMT) Received: from tigger.fuhr.org (tigger.fuhr.org [63.214.45.158]) by svr1.postgresql.org (Postfix) with ESMTP id 7C9493A6B7E for ; Sat, 11 Dec 2004 04:12:30 +0000 (GMT) Received: from winnie.fuhr.org (winnie.fuhr.org [10.1.0.1]) by tigger.fuhr.org (8.13.1/8.13.1) with ESMTP id iBB4Brf9004948 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 10 Dec 2004 21:11:56 -0700 (MST) (envelope-from mfuhr@winnie.fuhr.org) Received: from winnie.fuhr.org (localhost [127.0.0.1]) by winnie.fuhr.org (8.13.1/8.13.1) with ESMTP id iBB4Brvn063245; Fri, 10 Dec 2004 21:11:53 -0700 (MST) (envelope-from mfuhr@winnie.fuhr.org) Received: (from mfuhr@localhost) by winnie.fuhr.org (8.13.1/8.13.1/Submit) id iBB4BqUd063244; Fri, 10 Dec 2004 21:11:52 -0700 (MST) (envelope-from mfuhr) Date: Fri, 10 Dec 2004 21:11:52 -0700 From: Michael Fuhr To: "Muhyiddin A.M Hayat" Cc: pgsql-sql@postgresql.org Subject: Re: Create Calendar Message-ID: <20041211041152.GA63199@winnie.fuhr.org> References: <003801c4deee$451eb6c0$1f00a8c0@middinks> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <003801c4deee$451eb6c0$1f00a8c0@middinks> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.002 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200412/53 X-Sequence-Number: 19673 On Sat, Dec 11, 2004 at 03:26:33AM +0800, Muhyiddin A.M Hayat wrote: > How to create Calendar using Function/View. > For example i would like to display date 2004-12-01 to 2004-12-20. You could write a function that returns SETOF DATE. Some sections of the documentation you'll want to study are: "Data Types" chapter, "Date/Time Types" section "Functions and Operators" chapter, "Date/Time Functions and Operators" section "PL/pgSQL - SQL Procedural Language" chapter, especially the "Control Structures" section If you have trouble then please post what you've tried with an explanation of how you'd like it to work and a description of what actually happens. -- Michael Fuhr http://www.fuhr.org/~mfuhr/ From mail@joeconway.com Sat Dec 11 11:55:55 2004 X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 164D93A1D4C for ; Sat, 11 Dec 2004 11:55:55 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 15873-02 for ; Sat, 11 Dec 2004 11:55:43 +0000 (GMT) Received: from joeconway.com (wsip-24-249-201-67.sd.sd.cox.net [24.249.201.67]) by svr1.postgresql.org (Postfix) with ESMTP id 1051F3A6281 for ; Sat, 11 Dec 2004 11:55:44 +0000 (GMT) Received: from [192.168.4.1] (account jconway [192.168.4.1] verified) by joeconway.com (CommuniGate Pro SMTP 4.1.8) with ESMTP-TLS id 2395480; Sat, 11 Dec 2004 03:44:45 -0800 Message-ID: <41BAE040.9040207@joeconway.com> Date: Sat, 11 Dec 2004 03:55:44 -0800 From: Joe Conway User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.3) Gecko/20040922 X-Accept-Language: en-us, en MIME-Version: 1.0 To: "Muhyiddin A.M Hayat" Cc: pgsql-sql@postgresql.org Subject: Re: Create Calendar References: <003801c4deee$451eb6c0$1f00a8c0@middinks> In-Reply-To: <003801c4deee$451eb6c0$1f00a8c0@middinks> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.05 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200412/57 X-Sequence-Number: 19677 Muhyiddin A.M Hayat wrote: > How to create Calendar using Function/View. > For example i would like to display date 2004-12-01 to 2004-12-20. > > date > ------ > 2004-12-01 > 2004-12-02 > 2004-12-03 > 2004-12-04 > 2004-12-05 > .................. > .................. > 2004-12-20 -- Use in Postgres 7.4.x and earlier. -- In Postgres 8.0.0 generate_series() is a built-in function CREATE OR REPLACE FUNCTION generate_series(int, int) RETURNS setof int AS ' BEGIN FOR i IN $1..$2 LOOP RETURN NEXT i; END LOOP; RETURN; END; ' LANGUAGE plpgsql; select '2004/12/01'::date + f1 from generate_series(0, 19) as t(f1); ?column? ------------ 2004-12-01 2004-12-02 2004-12-03 2004-12-04 2004-12-05 [...] 2004-12-20 (20 rows) HTH, Joe