-
Notifications
You must be signed in to change notification settings - Fork 34
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
Error: execution of an external program failed #210
Comments
Interesting, you don't import norm/postgres by chance? |
And what about 2.8.5? |
2.8.5 works fine, 2.8.6 will report errors |
@Yakumo-Yukari Thanks for the clarification! Would you mind checking that this issue isn't related to the recent Nim 2.2.2 update? It's just that I'm not seeing anything that could add this new libpq dependency in 2.8.6: 2.8.5...2.8.6. So I'm thinking maybe Nim's import internals have been updated. |
os : win11 I'm using nim 2.2.0 and haven't upgraded to 2.2.2 yet. |
@PhilippMDoerner could you please take a look at your latest PR and check why pool module might suddenly start requiring libpq? |
That one comes out to a total of 4 lines of codes in change, at the very minimum that connection is non obvious through implicit magic that I'm not seeing. For reference: https://github.com/moigagoo/norm/pull/209/files That is changing a proc declaration to a variable assignment in 2 cases to turn them into closures and changing a type signature to require a closure: proc newPool*[T: sqlite.DbConn](defaultSize: Positive, getDbProc: proc(): sqlite.DbConn {.closure.} = sqlite.getDb, poolExhaustedPolicy = pepRaise): Pool[T] = As well as 1 fix of a double-import of std/os None of that hints at suddenly requiring libpq anywhere. The best I can think of is that the closure somehow causes something to not be treeshaken that was treeshaken out before ? |
I think the problem is in this line: let getDb* = proc(): DbConn {.closure.} = Since |
That brings us somewhat into a catch-22: Without that you can't assign getDb as a defaultvalue to pool, as long as it still requires a closure. So quick fix options thus are:
A more general fix that might take time to find would be:
|
@PhilippMDoerner I've opened a PR to attempt to fix this issue. First off, I've separated the tests for SQLite an Postgres, so that we could test different backends in isolation and make sure SQLite functionality doesn't depend on Postgres libs. Second, I did try replacing getDb declaration. The tests all pass on my machine, so I'd like to ask you to add a test case that would fail with |
@Yakumo-Yukari @PhilippMDoerner could you please try and test your codebases again this branch: https://github.com/moigagoo/norm/tree/feature/fix_pool_postgres_210 In your .nimble files, replace the Norm requirement line with this line:
|
Okay, now it's working. |
Great! If @PhilippMDoerner confirms that his code doesn't break either, I'll finalize that as a fix and cut a new release. |
norm 2.8.6
I am using the SQLite3 database, and after upgrading to version 2.8.6, the program is not running properly.
The text was updated successfully, but these errors were encountered: