Search type Search syntax
Tags [tag]
Exact "words here"
Author user:1234
user:me (yours)
Score score:3 (3+)
score:0 (none)
Answers answers:3 (3+)
answers:0 (none)
isaccepted:yes
hasaccepted:no
inquestion:1234
Views views:250
Sections title:apples
body:"apples oranges"
URL url:"*.example.com"
Favorites infavorites:mine
infavorites:1234
Status closed:yes
duplicate:no
migrated:no
wiki:no
Types is:question
is:answer
Exclude -[tag]
-apples
For more details on advanced search visit our help page
Results tagged with Search options answers only user 1822

Functions possibly returning more than one row. Typical examples are series generating functions or unnest(). A.k.a. "table-functions".

2
votes
This can be achieved using generate_series() with test_data (id, "first", "last") as ( values (42, 5, 8), (43, 6, 9) ) select td.id, g.nr from test_data td cross join lateral generate …
answered Oct 26 '18 by a_horse_with_no_name
4
votes
Set returning functions should be put into the from clause. Putting them into the SELECT clause is allowed, but can result in strange result (as you have noticed). The clean approach would be: sele …
answered Nov 19 '18 by a_horse_with_no_name
1
vote
The piece that you are missing is, that this is not a regular cross join, but a "LATERAL" cross join. So the fully written equivalent is: SELECT * FROM my_table CROSS JOIN LATERAL unnest(my_col …
answered Jun 25 by a_horse_with_no_name
0
votes
The temporary table will only make things slower, you don't need it. And if you change the function to be a SQL function, the Postgres optimizer can push the condition from the WHERE clause automatica …
answered Apr 9 by a_horse_with_no_name
4
votes
The error message is telling you that you can't use a set returning in the SELECT list. You need to put it into the FROM clause: SELECT array_agg(t.k) FROM table tbl, jsonb_object_keys(tbl.data) as …
answered Feb 16 '18 by a_horse_with_no_name
1
vote
Cast the actual value, not the set. SELECT v::date FROM generate_series('2018-01-01'::date, '2019-01-01'::date, '1 day') as t(v);
answered Jun 11 '17 by a_horse_with_no_name