Received: from localhost (maia-2.hub.org [200.46.204.187]) by postgresql.org (Postfix) with ESMTP id 4A6179FB793 for ; Wed, 2 May 2007 21:17:12 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.187]) (amavisd-maia, port 10024) with ESMTP id 24151-03 for ; Wed, 2 May 2007 21:17:04 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.4 Received: from web31815.mail.mud.yahoo.com (web31815.mail.mud.yahoo.com [68.142.206.168]) by postgresql.org (Postfix) with SMTP id E107C9FA4A3 for ; Wed, 2 May 2007 21:17:08 -0300 (ADT) Received: (qmail 88164 invoked by uid 60001); 3 May 2007 00:17:07 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=X-YMail-OSG:Received:Date:From:Subject:To:MIME-Version:Content-Type:Content-Transfer-Encoding:Message-ID; b=GGkpCDkbpQWaMtDLVpT75+speB+QvAbrbWaBoskmq/IRUsiyGNSNx47tNjcoKhUyj5Qh4q0ca8d+HA91MiyS/NQTJYcYO4vRSluD1DB+vmpHlik7dY3JRLRN05e/eNgI4cJ0chpI6MhZL8oBpF08wE9R0Gz7ahutxW1zfes4ikU=; X-YMail-OSG: ySQYCX4VM1lDkiL9lzyj5KsKtzxwvn.ndExFryrQzkffqHcrasBX8gMcanXI7i.W7KNAU_dFOg-- Received: from [75.84.89.248] by web31815.mail.mud.yahoo.com via HTTP; Wed, 02 May 2007 17:17:07 PDT Date: Wed, 2 May 2007 17:17:07 -0700 (PDT) From: Richard Broersma Jr Subject: Joe Celko's method to "generate_series" not working? To: SQL Postgresql List MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Message-ID: <649296.88043.qm@web31815.mail.mud.yahoo.com> X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=1.974 tagged_above=0 required=5 tests=AWL=-1.196, BAYES_40=-0.185, DNS_FROM_RFC_ABUSE=0.2, DNS_FROM_RFC_POST=1.708, DNS_FROM_RFC_WHOIS=1.447 X-Spam-Level: * X-Archive-Number: 200705/9 X-Sequence-Number: 28290 Well, I am about a book and a-half away from reading all of the Joe Celko's books that I know of. I just came across an nice looking way to generate a series using a set oriented construct. However, I am not able to get it to work in PostgreSQL. The method follows from the SQL Programming Style p.164: SELECT hundred * 100 + ten * 10 + unit + 1 FROM ( VALUES( 0, 1, 2, 3, 4, 5, 6, 7, 8, 9)) AS Units( unit ) CROSS JOIN ( VALUES( 0, 1, 2, 3, 4, 5, 6, 7, 8, 9)) AS Tens( ten ) CROSS JOIN ( VALUES( 0, 1, 2, 3, 4, 5, 6, 7, 8, 9)) AS Hundreds( hundred ); but I am getting: ?column? ---------- 1 (1 row) which isn't close to the 1000 rows that I am expecting. Is Mr. Celko mistaken? Does anyone know if PostgreSQL has any functions that I can turn these VALUES rows into columns so that the CROSS JOINS will work? Regards, Richard Broersma Jr.