postgres_fdw, dblink: Validate use_scram_passthrough values

Started by Fujii Masao6 months ago4 messageshackers
Jump to latest
#1Fujii Masao
masao.fujii@gmail.com

Hi,

The use_scram_passthrough option in postgres_fdw and dblink is
intended to accept only boolean values. However, unlike other boolean
options such as keep_connections, its value is not currently
validated.

As a result, invalid values are accepted unexpectedly, for example:

CREATE SERVER test_server
FOREIGN DATA WRAPPER postgres_fdw
OPTIONS (use_scram_passthrough 'invalid');

Attached patch updates postgres_fdw and dblink to validate
use_scram_passthrough values and throw an error for invalid input.

Regards,

--
Fujii Masao

Attachments:

v1-0001-postgres_fdw-dblink-Validate-use_scram_passthroug.patchapplication/octet-stream; name=v1-0001-postgres_fdw-dblink-Validate-use_scram_passthroug.patchDownload+5-2
#2Ayush Tiwari
ayushtiwari.slg01@gmail.com
In reply to: Fujii Masao (#1)
Re: postgres_fdw, dblink: Validate use_scram_passthrough values

Hi,

On Wed, 27 May 2026 at 20:12, Fujii Masao <masao.fujii@gmail.com> wrote:

Hi,

The use_scram_passthrough option in postgres_fdw and dblink is
intended to accept only boolean values. However, unlike other boolean
options such as keep_connections, its value is not currently
validated.

As a result, invalid values are accepted unexpectedly, for example:

CREATE SERVER test_server
FOREIGN DATA WRAPPER postgres_fdw
OPTIONS (use_scram_passthrough 'invalid');

Attached patch updates postgres_fdw and dblink to validate
use_scram_passthrough values and throw an error for invalid input.

Thanks for the patch, Fujii-san!

I applied it on HEAD and it looks good to me. The change looks consistent
with the existing validation of other boolean FDW options.

I also checked the behavior manually for both CREATE SERVER and CREATE USER
MAPPING in postgres_fdw and dblink. Invalid values are now rejected with:

ERROR: use_scram_passthrough requires a Boolean value

Regards,
Ayush

#3Matheus Alcantara
matheusssilv97@gmail.com
In reply to: Fujii Masao (#1)
Re: postgres_fdw, dblink: Validate use_scram_passthrough values

On 27/05/26 11:41, Fujii Masao wrote:

Hi,

The use_scram_passthrough option in postgres_fdw and dblink is
intended to accept only boolean values. However, unlike other boolean
options such as keep_connections, its value is not currently
validated.

As a result, invalid values are accepted unexpectedly, for example:

CREATE SERVER test_server
FOREIGN DATA WRAPPER postgres_fdw
OPTIONS (use_scram_passthrough 'invalid');

Attached patch updates postgres_fdw and dblink to validate
use_scram_passthrough values and throw an error for invalid input.

Hi,

Thank you for the patch. It looks correct to me and it fix the issue
as mentioned.

--
Matheus Alcantara
EDB: https://www.enterprisedb.com

#4Fujii Masao
masao.fujii@gmail.com
In reply to: Matheus Alcantara (#3)
Re: postgres_fdw, dblink: Validate use_scram_passthrough values

On Thu, May 28, 2026 at 3:22 AM Matheus Alcantara
<matheusssilv97@gmail.com> wrote:

Thank you for the patch. It looks correct to me and it fix the issue
as mentioned.

Thank Ayush and Matheus for the review! I've pushed the patch.

Regards,

--
Fujii Masao