Dynamic column in SELECT statement postgres

后端 未结 6 1641
温柔的废话
温柔的废话 2020-12-20 14:55

I am quite new to the postgresql.

what is the best way to achieve this?

SELECT get_columns() 
  FROM table_name;

get_columns(

6条回答
  •  南方客
    南方客 (楼主)
    2020-12-20 15:35

    I think your biggest problem is that you need to return rows in a way that PostgreSQL can understand. This means basically, you can return a refcursor or you can return a consistent set of data types. I prefer the latter because it makes the system a bit more consistent from a programming perspective and there are some advanced directions you can take that but I can see the other way too.

提交回复
热议问题