多行变成单行
teledb=# select array_to_string(array(select nickname from teledb_pg1),','); array_to_string ----------------- test,pg (1 row)
一列变成多行
teledb=# insert into teledb_pg1 values(6, 'teledb, teledb1'); INSERT 0 1 teledb=# select regexp_split_to_table((select nickname from teledb_pg1 where id=6 limit 1), ','); regexp_split_to_table ----------------------- teledb teledb1 (2 rows)