Comments (15)
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.
I ended up guilt tripping myself and building, should be released shortly
from otj-pg-embedded.
https://www.postgresql.org/docs/10/static/errcodes-appendix.html
from otj-pg-embedded.
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.
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.
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.
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.
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.
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.
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.
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.
OS dependent behavior is now there -> #89
from otj-pg-embedded.
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.
Waiting for a maintainer to merge it 😉
from otj-pg-embedded.
@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)
- IllegalStateException HOT 2
- No Postgres binary found for Darwin / aarch64 (Apple M1) HOT 2
- Lib not found HOT 3
- Snyk reports license warning for spotbugs-annotation dependency HOT 1
- Cannot resolve com.opentable.components:otj-spring:5.2.1 HOT 2
- Corrupted charsets in console HOT 1
- Catchpoint blog migration HOT 1
- Installed `postgres` binary is throwing segmentation fault on macOS 12.0 HOT 11
- Not working since upgrate to macOS 12 Monterey HOT 14
- PG Embedded - the Future (Update: 1.x now released) HOT 13
- M1 is not supported from the box HOT 2
- Cannot connect to database from other processes since 1.0.0 HOT 8
- The project README.md appears to have an incomplete statement HOT 3
- CurrVal function returns null in Postgres embedded db HOT 4
- Failed to build on Jenkins(docker refuses connection) HOT 3
- Unable to start postgresql on my machine HOT 2
- Can not connect to Ryuk at localhost:49163 HOT 1
- Docker environment failed issue HOT 3
- Darwin aarch64 support without Testcontainers HOT 1
- Java 8 compatibility HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from otj-pg-embedded.