1

This:

column_A|column_B|column_C
a|a,b,c|b
b|a|b
c|a|c

should end up like this:

column_A|column_B|column_C
a|a|b
a|b|b
a|c|b
b|a|b
c|a|c

column_B has CSV like data. columns are seperated by an arbitrary character in this case a comma.

Willi Mentzel
  • 27,862
  • 20
  • 113
  • 121

1 Answers1

5

You should be able to accomplish this with the combination of string_to_array and unnest:

SELECT column_a, unnest(string_to_array(column_b,',')), column_c 
FROM   tablename;

SQLFiddle

That said, you did not give enough information about the datatype and an arbitrary character is never arbitrary if it is acting as a delimiter.

vol7ron
  • 40,809
  • 21
  • 119
  • 172