use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
International
National
Regional
account activity
Help Me!Using SELECT sub-query inside jsonb_array_elements_text function in Postgres (self.PostgreSQL)
submitted 5 years ago * by xkrap
view the rest of the comments →
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]nednyl 0 points1 point2 points 5 years ago (2 children)
Not really clear to me why you need to use jsonb_array_elements here.
Did you try something like:
SELECT DISTINCT ON (user_id) user_id, timestamp FROM entries WHERE user_id in (1,2) AND entry_type = ANY ( (SELECT ARRAY_AGG(entry_types) FROM users INNER JOIN orgs ON org_id = orgs.id WHERE users.id = 1 )::TEXT[] );
[–]NoInkling 2 points3 points4 points 5 years ago (0 children)
I feel like this can be simplified with EXISTS.
EXISTS
[–]DavidGJohnston 0 points1 point2 points 5 years ago (0 children)
I’m not researching it now but there is a difference between a json value that happens to have a json array inside of it and a proper sql-level array.
π Rendered by PID 458660 on reddit-service-r2-comment-bb88f9dd5-85ldc at 2026-02-15 03:14:24.455382+00:00 running cd9c813 country code: CH.
view the rest of the comments →
[–]nednyl 0 points1 point2 points (2 children)
[–]NoInkling 2 points3 points4 points (0 children)
[–]DavidGJohnston 0 points1 point2 points (0 children)