橸誗柟誄闼底埇脘誫啂崔庯婔臯䔇庘昄㔗䕞嬉認婻䌂傋䔇庘昄埻橬废彖埙䫘潊庘昄套臘9-39欔誄㔗
臘9-39. 废彖埙䫘潊庘昄
庘昄 | 埗昄䌂傋 | 誫啂䌂傋 | 柟誄 |
---|---|---|---|
generate_series (start, stop) | int 潡 bigint | setof int 潡 setof bigint (婯埗昄䌂傋䕩劯) | 䫘潊婔婻昄唚废彖傯 start 彄 stop 準阪婺 1 㔗 |
generate_series (start, stop, step) | int 潡 bigint | setof int 潡 setof bigint (婯埗昄䌂傋䕩劯) | 䫘潊婔婻昄唚废彖傯 start 彄 stop 準阪婺 step 㔗 |
套悩 step 滇溼昄婫 start 崓庯 stop 闼幽誫啂镽臯㔗䕩埉套悩 step 滇蘘昄婫 start 償庯 stop 闼幽幘誫啂镽臯㔗套悩膷噖滇 NULL 劯湙库䫘镽臯㔗step 婺镽彍滇婔婻髍臇㔗婋麵滇婔底冋床
select * from generate_series(2,4); generate_series ----------------- 2 3 4 (3 rows) select * from generate_series(5,1,-2); generate_series ----------------- 5 3 1 (3 rows) select * from generate_series(4,3); generate_series ----------------- (0 rows) select current_date + s.a as dates from generate_series(0,14,7) as s(a); dates ------------ 2004-02-05 2004-02-12 2004-02-19 (3 rows)