Skip to content

Instantly share code, notes, and snippets.

@AlexeySoshin
Last active November 2, 2020 17: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 AlexeySoshin/5307667da4bbf008d876e0b6b7f2fea1 to your computer and use it in GitHub Desktop.
Save AlexeySoshin/5307667da4bbf008d876e0b6b7f2fea1 to your computer and use it in GitHub Desktop.
Creates virtual table from single string
select a[1]::integer as col1, a[2]::integer as col2, a[3]::float as col3, a[4] as col4, a[5] as col5
from (
select string_to_array(nest.l, ',') as a
from (
select unnest('{"3,2,82.38,null,World","4,1,43.12,Hello,null"}'::text[]) as l
) nest
) b;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment