postgis中用sql将表中每个字段转为小写字母

DO $$ 																							  
DECLARE 
    r RECORD; 
BEGIN 
    FOR r IN (SELECT table_name, column_name FROM information_schema.columns WHERE table_schema = 'public' AND table_name = 'your_table_name' AND column_name <> lower(column_name)) 
    LOOP 
        EXECUTE format('ALTER TABLE %I RENAME COLUMN %I TO %I', r.table_name, r.column_name, lower(r.column_name)); 
    END LOOP; 
END $$;


你可能感兴趣的:(MySQL,postgresq,MongoDB,Redis,postgis)