Syntax
<peer_name>
must be the name of an existing peer.<query_text>
is a string literal containing the SQL to run on the remote peer.
Examples
Run a simple select on a Postgres peer:Behavior
- The query text is forwarded verbatim to the remote database connection associated with the peer.
- Results are returned to the caller exactly as the remote database would return them.
Considerations
- The remote query runs with the credentials configured for the peer. Ensure the peer’s credentials have the minimal privileges required.
- Since the query runs directly on the remote system, it can modify data or schema. Be cautious when running DDL or DML via
EXECUTE
in production environments. - The query must use the dialect and capabilities of the remote database type.