pgtemp icon indicating copy to clipboard operation
pgtemp copied to clipboard

Make initdb args configurable

Open incrypto32 opened this issue 8 months ago • 6 comments

This PR aims to make the arguments for initdb command configurable.

incrypto32 avatar May 01 '25 14:05 incrypto32

Thanks for using pgtemp! This looks fine but I'm wondering in what situations you need to set the config via initdb and not at runtime via the with_config_param option. Incidentally it looks like I intended initially to use the server_configs with both initdb and the actual postgres execution but didn't / forgot to.

Would it make more sense to set the existing configs on initdb as well, or is there a usecase where they need to be separate? e.g. testing what happens when a db is created one way but then run with extra options later?

boustrophedon avatar May 01 '25 23:05 boustrophedon

Do the test failures occur for you locally? If not it could be an issue with the version of postgres in github CI

boustrophedon avatar May 02 '25 00:05 boustrophedon

Hey @boustrophedon a use case i can think of is to set the locale which is not possible to set in the server configuration.

As for the tests im afk right now, will check and report back if it works locally.

incrypto32 avatar May 02 '25 01:05 incrypto32

That makes sense and is indeed stated in the documentation https://www.postgresql.org/docs/current/locale.html

Some locale categories must have their values fixed when the database is created. You can use different settings for different databases, but once a database is created, you cannot change them for that database anymore. LC_COLLATE and LC_CTYPE are these categories

I took another look at the test and the output failure, lc_collate and lc_ctype are probably supposed to be in allcaps.

boustrophedon avatar May 02 '25 02:05 boustrophedon

Hi, it looks good except that the test is still failing because the method name wasn't changed in the test.

Could you squash all the commits as well when you have the tests passing? Thanks!

boustrophedon avatar May 06 '25 19:05 boustrophedon

@boustrophedon just fixed all of it, Ran cargo test this time 😅 and sorry for earlier. Looks like all test passes.

incrypto32 avatar May 08 '25 07:05 incrypto32

Hi @boustrophedon, is there any work pending to merge this PR? Can I help?

LNSD avatar Nov 05 '25 12:11 LNSD

Hi, I've been busy with work. This looks good except the commits still need to be squashed.

boustrophedon avatar Nov 06 '25 00:11 boustrophedon

@boustrophedon I just squashed the commits

incrypto32 avatar Nov 06 '25 10:11 incrypto32

thread 'buider_setters' panicked at tests/basic_operations.rs:108:10:
failed to execute LC_COLLATE query: Database(PgDatabaseError { severity: Error, code: "42704", message: "unrecognized configuration parameter \"lc_collate\"", detail: None, hint: None, position: None, where: None, schema: None, table: None, column: None, data_type: None, constraint: None, file: Some("guc.c"), line: Some(1241), routine: Some("find_option") })
stack backtrace:

well, that's not good https://github.com/boustrophedon/pgtemp/actions/runs/19150293475/job/54738465810

boustrophedon avatar Nov 06 '25 21:11 boustrophedon