CREATE EXTERNAL CONNECTION
CREATE EXTERNAL CONNECTION registers a reusable connection for an external
provider. A connection can be referenced by a SERVER, FDW, FCW, backup, or
remote operation.
CREATE EXTERNAL CONNECTION csv_local
PROVIDER csv
WITH (root = '/data/csv');
Connection options define shared access context. Options specific to one file or resource belong on the consuming object, usually the foreign table:
CREATE SERVER csv_files CONNECTION csv_local;
CREATE FOREIGN TABLE people_csv (
id int8,
name text
)
SERVER csv_files
WITH (file = 'people.csv', delimiter = ',', header = true);
Reference credentials through CREATE SECRET:
CREATE EXTERNAL CONNECTION aws_prod
PROVIDER aws
WITH (credentials = SECRET aws_credentials, region = 'us-east-1');
SECRET name is a reference, not the credential value. The server resolves the
secret when it validates or opens the provider. The catalog stores the
connection definition and secret reference, never the resolved credential.
Connection definitions are persisted in the catalog and remain available after a server restart. Logical dumps currently include external connection and server definitions only when their option lists are empty. Opaque provider options are not written because they may contain credentials, and the omitted definitions produce a warning. If an omitted definition has tags, dumping fails instead of silently losing those tags. Secret values are never included.
Full plain/custom dumps include foreign table definitions, comments, and tags
when their server and connection can be restored safely. Remote rows are not
copied. Option names that suggest credentials require a SECRET reference;
otherwise dumping stops rather than placing a possible credential in the
archive. Provision referenced secrets on the target first.
The provider validates its options and implements the capabilities it offers. The core stores the definition and routes provider operations to the matching provider.