Patch: UNNEST (and other functions) WITH ORDINALITY

Поиск
Список
Период
Сортировка
От David Fetter
Тема Patch: UNNEST (and other functions) WITH ORDINALITY
Дата
Msg-id 20130123062943.GB26369@fetter.org
обсуждение исходный текст
Ответы Re: Patch: UNNEST (and other functions) WITH ORDINALITY  (David Fetter <david@fetter.org>)
Re: Patch: UNNEST (and other functions) WITH ORDINALITY  (David Fetter <david@fetter.org>)
Список pgsql-hackers
Folks,

Please find attached a patch which implements the SQL standard
UNNEST() WITH ORDINALITY.  It doesn't stop there.  Any function call
in a FROM clause can now take WITH ORDINALITY, which appends a counter
(ordinality) column to the columns the function outputs and produce
results like this:

postgres@postgres:5493=# select * FROM pg_ls_dir('.') WITH ORDINALITY AS t(ls,n);
       ls        | n
-----------------+----
 pg_serial       |  1
 pg_twophase     |  2
 postmaster.opts |  3
 pg_notify       |  4
 postgresql.conf |  5
 pg_tblspc       |  6
 logfile         |  7
 base            |  8
 postmaster.pid  |  9
 pg_ident.conf   | 10
 global          | 11
 pg_clog         | 12
 pg_snapshots    | 13
 pg_multixact    | 14
 PG_VERSION      | 15
 pg_xlog         | 16
 pg_hba.conf     | 17
 pg_stat_tmp     | 18
 pg_subtrans     | 19
(19 rows)

TBD: polish the docs, add regression tests, possibly add psql support.

Thanks to Andrew (RhodiumToad) Gierth for the hard work designing and
implementing this feature.

Tom, is there some better way to do this?

Cheers,
David.
--
David Fetter <david@fetter.org> http://fetter.org/
Phone: +1 415 235 3778  AIM: dfetter666  Yahoo!: dfetter
Skype: davidfetter      XMPP: david.fetter@gmail.com
iCal: webcal://www.tripit.com/feed/ical/people/david74/tripit.ics

Remember to vote!
Consider donating to Postgres: http://www.postgresql.org/about/donate

Вложения

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

Предыдущее
От: Craig Ringer
Дата:
Сообщение: Re: Visual Studio 2012 RC
Следующее
От: David Fetter
Дата:
Сообщение: Re: .gitignore additions