-
Notifications
You must be signed in to change notification settings - Fork 28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes in PGENV_INITDB_OPTIONS (config-file) are not applied #56
Comments
This is somehow related to #52 and #54: if you change the One possible solution could be to change the loading mechanics: since Another, possibly better, approach could be to use |
Thank you for your quick response and sorry - I didn't see the two related items. |
|
you're right, declare -g is working. |
On my Mac:
|
Clearly, the newly created configuration file still has the @theory should we test for |
Ah, thank you for your clarification. I thought on a new build the default-config is somehow copied as version-config-file. Now I understand that this is not the case. |
To be more clear: the default config is used for a new build as a starting point, then the config is dumped (not copied) to a version specific file. The problem is, in fact, in the dumping strategy, that applies I wonder why Bash has such a different flag on OSX than on other Linux systems. |
Probably because the version of bash on macOS is super old:
Lots of people use the Homebrew bash, instead:
It includes |
I suspect the problem is arising from an old configuration file. However, this is true for newly written configuration files, not for migrated ( @17bob17 can you do the following and see if this works?
If that works, you should note that in your configuration specific version file you have an @theory if my guess is correct, we should at least warn the user that he has a default configuration file "older" than the one expected by the application. This means we should store and check a "versioning" into the configuration files... |
I tried it but unfortunately, it didn't work. I did the following (here with version 13.8): pgenv clear Configure flags, including PL languages but without --prefix Initdb flags pgenv build 13.8 - 13.8.conf newly written and now I have: Configure flags, including PL languages but without --prefix Initdb flags pgenv use 13.8 pg_configure shows: initdb prepares the cluster with en_US.UTF8 and without checksums Some observations: "pgenv config write" seems to duplicate the entries in default.conf but with "declare -ax" instead of "declare -g". Hope that helps a little bit. |
After trying it a little more:
But then came the idea: if we remove the
it works, even without an explicit @17bob17 can you please edit once again you configuration file, removing the |
Yes, you are right, all this is working: declare -g PGENV_INITDB_OPTIONS=(.....) The only thing is that I have to adjust the version-specific config-file between "build" and "use". But probably you know that. In my opinion it would be nice if the use-phase would take its config from the initial default-config. But maybe that is only good for my use case and could break other things. |
`declare -a` is used for arrays when `declare -p` dumps the configuration. However when `pgenv_configuration_read` gets back the configuration, variables becomes locally scoped (see `bash -c "help declare"). One solution could be to use `declare -g` to make variables globals, but this does not works on OSX. Removing `declare -a` from arrays seems to make the variable global even if no `EXPORT` is issued. As a possible compatibility statement, the `EXPORT` after each variable is left in place. Close theory#56
Hi, pgenv config write --> generates a default config file without declare-clause |
Tested it with the updated version using build and rebuild in varying constellations and now it works perfectly. Thank you very much. |
Great! @theory ok to merge and push a minor version? |
Yes! |
Hello,
first of all thank you for the great tool. I am pretty new to the tool and make my first steps with it.
My environment is:
OS: Redhat Linux 8.6 x64
Kernel: 4.18.0-372.19.1.el8_6.x86_64
Shell: Bash
User: postgres
pgenv-Version: 1.3.1
In default.conf (under directory config) I changed Initdb-Flags to:
declare -a PGENV_INITDB_OPTIONS=([0]="-U" [1]="postgres" [2]="--locale" [3]="de_DE.UTF-8" [4]="--encoding" [5]="UNICODE" [6]="--data-checksums")
Unfortuntely the new parameters didn't make it to the execution. Instead the standard values in the pgenv-script are used.
Changes of initdb-parameters will be applied if I change PGENV_INITDB_OPTIONS in the pgenv-script directly.
But I think the better solution would be the expected way with the change in the config-file.
The same problem seems to occur with changes in PGENV_CONFIGURE_OPTIONS.
I tried to debug the situation a little bit and it seems to me that the changes in the config-file are visible (exported) as long as I am in the function "pgenv_configuration_load" but get lost as soon as I leave the function.
But maybe it's a mistake on my side and I'm doing something wrong.
Best regards
Kai
The text was updated successfully, but these errors were encountered: