Joe Celko's method to "generate_series" not working?

Поиск
Список
Период
Сортировка
От Richard Broersma Jr
Тема Joe Celko's method to "generate_series" not working?
Дата
Msg-id 649296.88043.qm@web31815.mail.mud.yahoo.com
обсуждение исходный текст
Ответы Re: Joe Celko's method to "generate_series" not working?  (Richard Broersma Jr <rabroersma@yahoo.com>)
Список pgsql-sql
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.


В списке pgsql-sql по дате отправления:

Предыдущее
От: Richard Albright
Дата:
Сообщение: Re: Possible to access value in RECORD without knowing column name?
Следующее
От: Richard Broersma Jr
Дата:
Сообщение: Re: Joe Celko's method to "generate_series" not working?