Git Product home page Git Product logo

Comments (15)

mikebell90 avatar mikebell90 commented on August 20, 2024 1

That sounds reasonable. Maybe Steven wil have an idea. In meantime why not use the sql error code for some of this? It's language independent and hence a better thing to code against.

from otj-pg-embedded.

mikebell90 avatar mikebell90 commented on August 20, 2024 1

I ended up guilt tripping myself and building, should be released shortly

from otj-pg-embedded.

mikebell90 avatar mikebell90 commented on August 20, 2024

https://www.postgresql.org/docs/10/static/errcodes-appendix.html

from otj-pg-embedded.

vikeshpandey avatar vikeshpandey commented on August 20, 2024

thanks for pointing this out. Yes i agree that using error code is better coding style. but still the overriding of locale should work if this lib has provided an option for it.

from otj-pg-embedded.

mikebell90 avatar mikebell90 commented on August 20, 2024

Reading https://www.postgresql.org/docs/9.5/static/app-initdb.html and noting the code just literally takes whatever you send and adds to the command line, makes me think your switches are totally wrong

--locale=locale
Sets the default locale for the database cluster. If this option is not specified, the locale is inherited from the environment that initdb runs in. Locale support is described in Section 22.1.

--lc-collate=locale
--lc-ctype=locale
--lc-messages=locale
--lc-monetary=locale
--lc-numeric=locale
--lc-time=locale
Like --locale, but only sets the locale in the specified category.

I'd read that as saying a) use lc_messages, and b) use lower case.

from otj-pg-embedded.

vikeshpandey avatar vikeshpandey commented on August 20, 2024

sorry for delay in response. the approach mentioned above worked for somebody on stackoverflow, i wonder how can the switch be wrong :).
Anyways, i tried it with your suggestions and followed the locale codes as specified at: https://www.postgresql.org/docs/9.5/static/locale.html , PFB:

postgres = EmbeddedPostgres.builder()
                    .setLocaleConfig("locale", "en_US")
                    .setLocaleConfig("lc-messages", "locale")
                    .start();

and this is the feedback:

java.lang.IllegalStateException: Process [C:\Users\VIKESH~1\AppData\Local\Temp\embedded-pg\PG-20610842f7206a9abbecdcf12709c0f8\bin\initdb.exe, -A, trust, -U, postgres, -D, C:\Users\VIKESH~1\AppData\Local\Temp\epg8334278739380596628, -E, UTF-8, --locale, en_US, --lc-messages, locale] failed

	at com.opentable.db.postgres.embedded.EmbeddedPostgres.system(EmbeddedPostgres.java:585)
	at com.opentable.db.postgres.embedded.EmbeddedPostgres.initdb(EmbeddedPostgres.java:227)
	at com.opentable.db.postgres.embedded.EmbeddedPostgres.<init>(EmbeddedPostgres.java:145)
	at com.opentable.db.postgres.embedded.EmbeddedPostgres$Builder.start(EmbeddedPostgres.java:572)
	at com.assaabloy.msf.common.postgres.common.EmbeddedPostgresHelper.startPostgresInMemoryAndSetConnectionUrl(EmbeddedPostgresHelper.java:52)
	at com.assaabloy.msf.common.postgres.common.EmbeddedPostgresHelper.<clinit>(EmbeddedPostgresHelper.java:40)

from the logs it looks to be incorrectly supplied to PG process.

from otj-pg-embedded.

Poeschl avatar Poeschl commented on August 20, 2024

Having the same problem here. It seems that the generated locale parameter --locale, en_US should be --locale=en_US. According to the initdb docs only the short flags are separated with a space.

from otj-pg-embedded.

GertVil avatar GertVil commented on August 20, 2024
EmbeddedPostgres pg = EmbeddedPostgres.builder()
                .setLocaleConfig("locale", "en_US")
                .setLocaleConfig("lc-messages", "en_US")
                .start();

Does seem to work for me with the current code... I added a test to see if it starts and it does.
.setLocaleConfig("lc-messages", "locale") does not work so maybe "locale" is not a valid value in this case? @Poeschl did the locale not take effect or did your server not start? What is the command you are using to build the postgres?

from otj-pg-embedded.

Poeschl avatar Poeschl commented on August 20, 2024

I updated to the latest version (com.opentable.components:otj-pg-embedded:0.12.1) and tested it with those lines:

final EmbeddedPostgres ep = EmbeddedPostgres.builder()
            .setLocaleConfig("locale", "en_US")
            .setLocaleConfig("lc-messages", "en_US")
            .setCleanDataDirectory(true)
            .start();

Unfortunately it fails to start and crashes the startup of the test environment.
My error is the same like from @vikeshpandey :

Caused by: java.lang.IllegalStateException: Process [C:\temp\marpoe\embedded-pg\PG-f36c805f81454285f832e33b0a7ec535\bin\initdb.exe, -A, trust, -U, postgres, -D, C:\temp\marpoe\epg5722912534294344876, -E, UTF-8, --locale, en_US, --lc-messages, en-US] failed

	at com.opentable.db.postgres.embedded.EmbeddedPostgres.system(EmbeddedPostgres.java:585) ~[otj-pg-embedded-0.12.1.jar:0.12.1]
	at com.opentable.db.postgres.embedded.EmbeddedPostgres.initdb(EmbeddedPostgres.java:227) ~[otj-pg-embedded-0.12.1.jar:0.12.1]
	at com.opentable.db.postgres.embedded.EmbeddedPostgres.<init>(EmbeddedPostgres.java:145) ~[otj-pg-embedded-0.12.1.jar:0.12.1]
	at com.opentable.db.postgres.embedded.EmbeddedPostgres$Builder.start(EmbeddedPostgres.java:572) ~[otj-pg-embedded-0.12.1.jar:0.12.1]
...

from otj-pg-embedded.

GertVil avatar GertVil commented on August 20, 2024

Ah, right the behaviour will be different between mac and windows then. It starts without the "=" for me too. The test you created in your PR also runs for without any code changes in EmbeddedPostgres.java.

from otj-pg-embedded.

Poeschl avatar Poeschl commented on August 20, 2024

ok, I just saw it in the travis tests. I will make different cases for MAC and Windows (Linux will be tested also).

from otj-pg-embedded.

Poeschl avatar Poeschl commented on August 20, 2024

OS dependent behavior is now there -> #89

from otj-pg-embedded.

StephanPraetsch avatar StephanPraetsch commented on August 20, 2024

How far is #89 to be released? I'd love to test if that fixes my broken behavior.

Caused by: java.lang.IllegalStateException: Process [/tmp/embedded-pg/PG-6e6cb600c5af6f0b241f84df1594a9c6/bin/initdb, -A, trust, -U, postgres, -D, /tmp/epg5257266741422711163, -E, UTF-8] failed

	at com.opentable.db.postgres.embedded.EmbeddedPostgres.system(EmbeddedPostgres.java:585)
	at com.opentable.db.postgres.embedded.EmbeddedPostgres.initdb(EmbeddedPostgres.java:227)
	at com.opentable.db.postgres.embedded.EmbeddedPostgres.<init>(EmbeddedPostgres.java:145)

from otj-pg-embedded.

Poeschl avatar Poeschl commented on August 20, 2024

Waiting for a maintainer to merge it 😉

from otj-pg-embedded.

mikebell90 avatar mikebell90 commented on August 20, 2024

@StephanPraetsch Currently don't have time to review the PRs. Hoping workload will ease in next few months. Sigh.

from otj-pg-embedded.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.