char *appname;
char *sep = "";
+ /*
+ * SCRAM pass-through cannot work for subscriptions because the connection
+ * happens in a worker process.
+ */
+ if (UseScramPassthrough(server, user))
+ ereport(ERROR,
+ (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+ errmsg("SCRAM pass-through authentication is not supported for subscription connections"),
+ errdetail("The foreign server or user mapping for user \"%s\" has \"use_scram_passthrough\" enabled.",
+ GetUserNameFromId(userid, false)),
+ errhint("Store a password in the user mapping instead.")));
+
construct_connection_params(server, user, &keywords, &values, &appname);
initStringInfo(&str);
);
$node_subscriber->safe_psql('postgres',
- "CREATE USER MAPPING FOR PUBLIC SERVER tap_server");
+ "CREATE USER MAPPING FOR PUBLIC SERVER tap_server OPTIONS (use_scram_passthrough 'true')"
+);
+
+my ($ret, $stdout, $stderr) = $node_subscriber->psql('postgres',
+ "CREATE SUBSCRIPTION tap_sub SERVER tap_server PUBLICATION tap_pub WITH (password_required=false)"
+);
+isnt($ret, 0, 'CREATE SUBSCRIPTION fails with use_scram_passthrough');
+like(
+ $stderr,
+ qr/ERROR.*SCRAM pass-through authentication is not supported for subscription connections/,
+ 'CREATE SUBSCRIPTION gives correct connection error');
+
+$node_subscriber->safe_psql('postgres',
+ "ALTER USER MAPPING FOR PUBLIC SERVER tap_server OPTIONS (DROP use_scram_passthrough)"
+);
$node_subscriber->safe_psql('postgres',
"CREATE SUBSCRIPTION tap_sub SERVER tap_server PUBLICATION tap_pub WITH (password_required=false)"
This is a technical requirement of the SCRAM protocol.
</para>
</listitem>
+
+ <listitem>
+ <para>
+ The foreign server must not be used for subscription connections
+ (see <xref linkend="postgres-fdw-server-subscription"/>).
+ </para>
+ </listitem>
</itemizedlist>
</para>
</listitem>