-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
sql/pgwire: Elixir Connection Issues - Postgrex Protocol Errors - First Test #5582
Comments
Seems like we don't quite see the whole query, but we do see |
"ARRAY - AFAIK we don't support that yet" I just noticed issue #2115, after you mentioned the lack of ARRAY support. I will try again once it's closed. |
I tried a similar series of tests but using Phoenix Framework hence Ecto w/Postgrex as a starting point. The initial database create failed upon an I proceeded to manually create the database but upon creation of a basic model encountered an error related to the lack of
I acknowledge this is more of an FYI at this point. |
We would very much like to be able to use Cockroach with Elixir but it seems that for the driver (postgrex) to support it, the following issues would need to be resolved:
Source: elixir-ecto/postgrex#213 Is there any chance the above could be solved to help out on the elixir side ? |
I thought we already supported the "close" packet for prepared statements. Can you provide more detail about what's not working for you? There are no plans to support savepoints (beyond the limited form that we currently support for transaction retries). For error codes, we're unlikely to ever be 100% compatible with postgres in this respect, but if you can identify specific error codes that you check for we can prioritize supporting those cases. |
@bdarnell I am using A
The issue relating to savepoint error handling was a bug in the client, not cockroach. However there is a surprise that a savepoint error does not cause the transaction to enter the The different error codes were causing some test failures. There is also an issue with numeric values. The |
Regarding matched error codes in postgrex test files, here is my finding:
As far as test goes, I have ignored error code matched in Only 8 error codes are matched in the tests as follow:
|
Thanks, we'll look into these. |
I have created separate issues to track your various findings. Regarding the error codes, what do you propose would work the best for you? As Ben explained earlier we're not keen on matching pg one-for-one, but what would be the next best thing? |
Ok, let's do that |
Fixing #8296 gets us down to 151 failures (from 213). A lot of these failures are because of unsupported types, tables, functions, The remaining failures are:
|
Hi @fishcakez we've addressed #8298 and I have filed the remaining issues that you found. Is there anything else you've found since then? |
@fishcakez any chance to give it another try now that pretty much all issues have been closed and a new beta has been released ? I wonder if the following from changelog can help a bit as well:
|
I will try to catch up with this again soon. |
I had a little chat with @fishcakez a few days back and it appears there are still too many issues using the wire protocol/SQL to really make Postgrex working with CockroachDB :( So the futur of Elixir/Ecto with CockroachDB does not look too bright right now, it seems it will take some substantial efforts to get something working. It's pretty sad, was very eager to use CockroachDB in my new project but it looks like I have no other choice but to stick with Postgres for the time being. |
It would really help if you could still give us an overview of what you've run into this time. |
@fishcakez care to elaborate a little bit on the subject please ? |
@knz the most significant barrier is lack of Also Postgrex is very tied to Ecto (like an ORM but without objects), it is even maintained by the same group of people. The feature set of postgrex is based on Ecto and we only add features to postgrex that we want in Ecto. This leads to a very opinionated client, for example we only support extended queries. To run Ecto's integration test suite or to use Ecto's testing tools for user projects requires the savepoint API. This means we can't support cockroachdb in the main project that determines postgrex's features either. A postgrex connection uses the
I no longer have my branch of postgrex that could run the postgrex test suite against cockroachdb. If we try to run master (or any recent tag) we get an error setting up the tests:
I am sorry that I have quite the opposite of "substantial effort" to help you. I reported the previous issues because I was testing postgrex against cockroachdb to discover issues in postgrex. My advise to anyone wanting to use cockroachdb is to fork postgrex and remove features until it works or use a different client. There are numerous Erlang ones. |
Can confirm that I get problems with a fresh Phoenix app using stock Ecto and stock Postgrex. Error:
Elixir-side versions:
Cockroach-side versions:
|
Is it possible to get the query that ecto is trying to execute? |
Not sure of the query but I get it when running |
@yonkeltron you have to use my Postgrex fork for the time being |
@tlvenn Can you make it a proper postgrex fork with a name change? |
Is this ready to be tested again with Ecto? Happy to spin up a fresh app and give it a shot. |
@fire this is finally done, I have published the fork at: And to run your test, given CDB does not support arbitrary savepoints, you cant use the sandbox that is bundled with Ecto but fear not, I have created EctoReplaySandbox to leverage a log replay approach to do it: For reference @jordanlewis , the only remaining issue so that we would not need my postgrex fork is support for correlated subqueries which is tracked here: #3288 Happy hacking and testing ;) |
@tlvenn et all, Thank you for your work on this CockroachDB fork of the postgrex adapter. Over the weekend I spun up a new Elixir :ecto, "2.2.7" project that I was able to get working with CockroachDB and this adapter fork - with some caveats I wanted to share to help others: https://gist.github.com/cohawk/df29c1c54abd858dd19d8327e862822a |
I just wanted to update this issue a bit. @vilterp and I tried running an example app with Ecto and it looks like we've made significant progress here. We did run into #32917 during the migration step. So that will be a bit of a blocker. However, once we hacked around that in cockroach, the app actually ran. |
Hi @BramGruneir! Any update on this? |
@fishcakez Are you able to provide instructions, the test suite is a bit convoluted to run and the documentation is lacking. There's two suites, one is the sql syntax and the other is an ecto adapter on a real database. |
|
I'm going to close this in favor of #33441. |
All,
When trying to connect to CockroachDB with the Elixir Postgresql driver "Postgrex" (https://github.com/ericmj/postgrex) I get some Errors related to the Postgresql protocol. I'm guessing that there may be some missing pieces in the CockroachDB implementation of the Postgresql protocol that Postgrex is looking for. Here are some details from this initial connection test:
Build Vers: go1.6
Build Tag: alpha.v1-1423-ga8c1cb4
Build Time: 2016/03/25 18:03:44
Example Error Messages:
16:03:46.617 [error] GenServer #PID<0.3938.0> terminating
** (Postgrex.Error) ERROR (internal_error): syntax error at or near "("
SELECT t.oid, t.typname, t.typsend, t.typreceive, t.typoutput, t.typinput,
t.typelem, coalesce(r.rngsubtype, 0), ARRAY (
^
Last message: nil
State: nil
16:03:46.619 [error] GenServer #PID<0.3939.0> terminating
** (Postgrex.Error) ERROR (internal_error): syntax error at or near "("
SELECT t.oid, t.typname, t.typsend, t.typreceive, t.typoutput, t.typinput,
t.typelem, coalesce(r.rngsubtype, 0), ARRAY (
^
Last message: nil
State: nil
-- Nick
The text was updated successfully, but these errors were encountered: