Skip to content

Instantly share code, notes, and snippets.

@barsbek
Created March 19, 2018 09:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save barsbek/5388fd1bc0e95f04463992e47f587620 to your computer and use it in GitHub Desktop.
Save barsbek/5388fd1bc0e95f04463992e47f587620 to your computer and use it in GitHub Desktop.
postgresql: generate indexes of the given matrix (multidimensional array)
select generate_subscripts(array[array[1,2,3], array[4,5,6]], 2); -- 1,2,3
select generate_subscripts(array[array[1,2,3], array[4,5,6]], 1); -- 1,2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment