0

Is it possible to query the pg_catalog schema of a remote Postgres server? I'm trying to access some simple statistics of a remote server. I've tried importing the foreign schema, but it fails on an anyarray column.

psql> IMPORT FOREIGN SCHEMA pg_catalog LIMIT TO (pg_stats) FROM SERVER myserver into myschema;
ERROR:  column "most_common_vals" has pseudo-type anyarray
CONTEXT:  importing foreign table "pg_stats"

I'm able to individually import tables that don't have anyarray columns.

Ian Hunter
  • 9,466
  • 12
  • 61
  • 77

1 Answers1

1

You could define a view (on the foreign side) which casts those columns to text, then create a foreign table for that view instead of the original. Not very elegant, but it works. But you do have to have create privs on the foreign side, or have the cooperation of someone who does.

I don't know what will happen for stats over bytea columns.

jjanes
  • 37,812
  • 5
  • 27
  • 34