liujiusheng / blog

个人博客,blog
19 stars 0 forks source link

PG数据库中排除某字段 #242

Open liujiusheng opened 2 years ago

liujiusheng commented 2 years ago

将PG作为空间数据库时,由于geom字段过大,通常需要排除本字段,但其它字段又不可穷举,所以需要以下代码(排除了geom和OBJECTID字段):

SELECT array_to_string(ARRAY(SELECT 'o' || '.' || c.column_name FROM information_schema.columns As c WHERE table_name = 'DLTB_0238a728cd5e436fbcbd9970be99d7f0' AND c.column_name NOT IN('geom','OBJECTID') ), ',')