hi. SELECT * FROM pg_catalog.pg_restore_relation_stats( 'relation', 'public.tenk1_hundred'::regclass, 'version', '180000'::integer, 'relpages', '11'::integer, 'reltuples', '10000'::real, 'relallvisible', '0'::integer ); dump and execute the above query generated a warning WARNING: missing lock for relation "tenk1_hundred" (OID 18431, relkind i) @ TID (15,34)
in dumpRelationStats(Archive *fout, const RelStatsInfo *rsinfo) { getAttStatsExportQuery(query, fout, dobj->namespace->dobj.name, dobj->name); res = ExecuteSqlQuery(fout, query->data, PGRES_TUPLES_OK); appendAttStatsImport(out, fout, res); PQclear(res) } i think, getAttStatsExportQuery no need to join catalog pg_namespace. for example, after getAttStatsExportQuery, query->data looks like: SELECT c.oid::regclass AS relation, s.attname,s.inherited, current_setting('server_version_num') AS version, s.null_frac, s.avg_width, s.n_distinct, s.most_common_vals, s.most_common_freqs, s.histogram_bounds, s.correlation, s.most_common_elems, s.most_common_elem_freqs, s.elem_count_histogram, s.range_length_histogram, s.range_empty_frac, s.range_bounds_histogram FROM pg_stats s JOIN pg_namespace n ON n.nspname = s.schemaname JOIN pg_class c ON c.relname = s.tablename AND c.relnamespace = n.oid WHERE s.schemaname = 'public' AND s.tablename = 'varchar_tbl' ORDER BY s.attname, s.inherited ----------------------- The SELECT column list doesn't mention/use any of the pg_namespace columns. ```WHERE s.schemaname = 'public' AND s.tablename = 'varchar_tbl'`` " s.schemaname" combined with "s.tablename" will make sure that the output is unique, at most one row. i did a minor refactor about validation dumpData, dumpSchema, dumpStatistics option. I think it's more intuitive. first we process ``*only``option then process no* option
refactor_pg_dump_onlyoption.no-cfbot
Description: Binary data