I tried to use COPY command to export and import tables from catalog,
but COPY command has problem with data type regproc. See example
create table test (like pg_aggregate); copy pg_aggregate to '/tmp/pg_agg.out'; copy test from '/tmp/pg_agg.out';
ERROR: more than one function named "pg_catalog.avg"
CONTEXT: COPY test, line 1, column aggfnoid: "pg_catalog.avg"
The problem is that pg_proc table has following unique indexes:
"pg_proc_oid_index" UNIQUE, btree (oid) "pg_proc_proname_args_nsp_index" UNIQUE, btree (proname, proargtypes,
pronamespace)
And regprocin in the backend/utils/adt/regproc.c cannot found unique OID
for proname.
Workaround is use binary mode, but on other side aclitem is not
supported in the binary mode.
postgres=# copy pg_class to '/tmp/pg_class.out' binary; ERROR: no binary output function available for type
aclitem
The solution is that COPY command will be use OID instead procname for
export regproc.
Zdenek