본문 바로가기

카테고리 없음

테이블 select 자동 postgresql

select 'select '
union all
select 
 'a.' || a.column_name  ||','
from information_schema.columns a
left outer join pg_catalog.pg_description b
on b.objsubid = a.ordinal_position
inner join pg_class c
on b.objoid=c.oid 
and c.relname =a.table_name
where 1=1 
and a.table_schema='public'
and a.table_name='tb_optkwfid'
union all
select ' from tb_optkwfid a '