SELECT a.schemaname schema_name, a.tablename table_name, string_agg(b.column_name, ',') AS columns FROM (SELECT schemaname, tablename FROM pg_tables WHERE schemaname = 'public' and tablename like 'test%') a
LEFT JOIN (SELECT table_name, column_name FROM information_schema.columns where table_schema = 'public') b
ON a.tablename = b.table_name
GROUP BY a.schemaname, a.tablename;
CREATE INDEX ind_test_idempotent_version ON test (idempotent, version);
ALTER TABLE test ADD PRIMARY KEY (xh);
ALTER TABLE test ADD COLUMN version VARCHAR(32);
comment on column test.version is '版本号';