Skip to content

Commit

Permalink
Add docs for SRF column accessors
Browse files Browse the repository at this point in the history
  • Loading branch information
rmloveland committed Oct 2, 2018
1 parent 514b45f commit 941128c
Showing 1 changed file with 21 additions and 1 deletion.
22 changes: 21 additions & 1 deletion v2.1/table-expressions.md
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,27 @@ For example:
+-----------------+
~~~

{{site.data.alerts.callout_info}}Currently CockroachDB only supports a small set of generator function compatible with <a href="https://www.postgresql.org/docs/9.6/static/functions-srf.html">the PostgreSQL set-generating functions of the same name</a>.{{site.data.alerts.end}}
<span class="version-tag">New in v2.1:</span> Set-returning functions (SRFs) can now be accessed using `(SRF).x` where `x` is either:

- The name of a column returned from the function, or
- `*` to denote all columns.

For example:

{% include copy-clipboard.html %}
~~~ sql
> SELECT (i.keys).* FROM (SELECT information_schema._pg_expandarray(indkey) AS keys FROM pg_index) AS i;
~~~

~~~
x | n
---+---
1 | 1
2 | 1
(2 rows)
~~~

{{site.data.alerts.callout_info}}Currently CockroachDB only supports a small set of generator functions compatible with <a href="https://www.postgresql.org/docs/9.6/static/functions-srf.html">the PostgreSQL set-generating functions with the same names</a>.{{site.data.alerts.end}}

## Operators that extend a table expression

Expand Down

0 comments on commit 941128c

Please sign in to comment.