pg_tde_change_key_provider binary has '[-D <datadir>]' option is optional but it don't consider it even environment variable PGDATA is available

Description

while using ‘pg_tde_change_key_provider’ binary if user don’t pass the optional '[-D <datadir>]' switch in the command line, the tool is not working.

If the PGDATA environment variable not set then it throw error message.

Error: Data directory missing.

But when the PGDATA environment variable is set then it shows help menu.

postgres@ubuntu241:~/pginst/bin$ export PGDATA= postgres@ubuntu241:~/pginst/bin$ ./pg_tde_change_key_provider 16478 'khan-provider' file '/home/postgres/_pg_tde_khan-key.per' pg_tde_change_key_provider changes the configuration of a pg_tde key provider Usage: pg_tde_change_key_provider [-D <datadir>] <dbOid> <provider_name> <new_provider_type> <provider_parameters...> Where <new_provider_type> can be file, vault or kmip Depending on the provider type, the complete parameter list is: pg_tde_change_key_provider [-D <datadir>] <dbOid> <provider_name> file <filename> pg_tde_change_key_provider [-D <datadir>] <dbOid> <provider_name> vault <token> <url> <mount_path> [<ca_path>] pg_tde_change_key_provider [-D <datadir>] <dbOid> <provider_name> kmip <host> <port> <cert_path> [<ca_path>] WARNING: This tool only changes the values, without properly XLogging the changes, or adjusting the configuration in the running postgres processes. Only use it in case the database is inaccessible and can't be started. Error: Data directory missing.

Setting PGDATA environment variable for example, then it is not working as by design
export PGDATA=/home/postgres/pginst/data

postgres@ubuntu241:~/pginst/bin$ export PGDATA=/home/postgres/pginst/data/ postgres@ubuntu241:~/pginst/bin$ echo $PGDATA /home/postgres/pginst/data/ postgres@ubuntu241:~/pginst/bin$ ./pg_tde_change_key_provider 16478 'khan-provider' file '/home/postgres/_pg_tde_khan-key.per' pg_tde_change_key_provider changes the configuration of a pg_tde key provider Usage: pg_tde_change_key_provider [-D <datadir>] <dbOid> <provider_name> <new_provider_type> <provider_parameters...> Where <new_provider_type> can be file, vault or kmip Depending on the provider type, the complete parameter list is: pg_tde_change_key_provider [-D <datadir>] <dbOid> <provider_name> file <filename> pg_tde_change_key_provider [-D <datadir>] <dbOid> <provider_name> vault <token> <url> <mount_path> [<ca_path>] pg_tde_change_key_provider [-D <datadir>] <dbOid> <provider_name> kmip <host> <port> <cert_path> [<ca_path>] WARNING: This tool only changes the values, without properly XLogging the changes, or adjusting the configuration in the running postgres processes. Only use it in case the database is inaccessible and can't be started.

Environment

None

Activity

Show:

shahidullah.khan last week

You are right for empty data directory it says “Error: Data directory missing.”
this is what it is saying in the first message which I shared.

The issue is coming when I have PGDATA environment variable set and I don’t pass data directory switch(which by design is optional) then it says nothing and just print help message. It should work when PGDATA directory is in the environment.

Zsolt Parragi last week

You didn’t copy the last line - it prints the help, then it at the last line say “Error: Data directory missing.”

It says that because you specified an empty data directory.

Details

Assignee

Reporter

Needs QA

Yes

Components

Priority

Smart Checklist

Created last week
Updated last week

Flag notifications