X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id DE4D49DCA3B for ; Fri, 17 Feb 2006 17:14:50 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 57993-04 for ; Fri, 17 Feb 2006 17:14:52 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from nelson.osl.com (216-21-133-120.ip.van.radiant.net [216.21.133.120]) by postgresql.org (Postfix) with ESMTP id 9A9F39DCA16 for ; Fri, 17 Feb 2006 17:14:48 -0400 (AST) Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable X-MimeOLE: Produced By Microsoft Exchange V6.5.7226.0 Subject: Re: Given 02-01-2006 to 02-28-2006, output all days. Date: Fri, 17 Feb 2006 13:14:46 -0800 Message-ID: <144D12D7DD4EC04F99241498BB4EEDCC220D19@nelson.osl.com> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [SQL] Given 02-01-2006 to 02-28-2006, output all days. Thread-Index: AcY0BjHx6d7by6jcRsaYDaSpuaohrAAAKS/w From: "Owen Jacobson" To: X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.104 required=5 tests=[AWL=0.104] X-Spam-Score: 0.104 X-Spam-Level: X-Archive-Number: 200602/218 X-Sequence-Number: 24228 Henry Ortega wrote: (question about set of all days between two dates) I don't know of a builtin way to do it off the top of my head, but it's = a pretty simple function to write: create function days (start date, finish date) returns setof date as $$ declare curdate date; begin curdate :=3D start; while (curdate <=3D finish) loop return next curdate; curdate :=3D curdate + 1; end loop; return; end; $$ language plpgsql; # select * from days ('2006-02-01', '2006-02-07'); days ------------ 2006-02-01 2006-02-02 2006-02-03 2006-02-04 2006-02-05 2006-02-06 2006-02-07 (7 rows)