-
-
Notifications
You must be signed in to change notification settings - Fork 61
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
Postgres broken with ArcadeDB on Elixir - Cannot connect, Bug Project included #1815
Comments
What are the ArcadeDB logs saying when you connect? This looks like an SQL grammar error(?). |
Hey @gramian ! Thanks for the quick reply. On the Arcade end, I am not sure what to make of it. I just get:
That is the initial normal start up. It idles there until I try to run the Elixir test project, which then triggers the following:
This repeats every time Elixir tries to connect again, as it tries every 1-3 seconds or so repeatedly. Thanks again for any thoughts or solutions. |
I found a thread here: Which looked like a similar problem perhaps though from Rust where @lvca suggested using
So I tried that, and this is what I got. I am not sure if it is meaningful toward a solution, but I am hopeful that it is. Any thoughts?
|
So, this gives a hint. Apparantly the following SQL query is send by the Elixir driver: SELECT t.oid, t.typname, t.typsend, t.typreceive, t.typoutput, t.typinput,
coalesce(d.typelem, t.typelem), coalesce(r.rngsubtype, 0), ARRAY (
SELECT a.atttypid
FROM pg_attribute AS a
WHERE a.attrelid = t.typrelid AND a.attnum > 0 AND NOT a.attisdropped
ORDER BY a.attnum
)
FROM pg_type AS t
LEFT JOIN pg_type AS d ON t.typbasetype = d.oid
LEFT JOIN pg_range AS r ON r.rngtypid = t.oid OR (t.typbasetype <> 0 AND r.rngtypid = t.typbasetype)
WHERE (t.typrelid = 0)
AND (t.typelem = 0 OR NOT EXISTS (SELECT 1 FROM pg_catalog.pg_type s WHERE s.typrelid != 0 AND s.oid = t.typelem)) which uses the Postgres system "tables" Maybe there is a way to use Postgrex without this startup query? |
ArcadeDB Version:
24.10.1
OS and JDK Version:
Running on Linux 5.15.153.1-microsoft-standard-WSL2 - OpenJDK 64-Bit Server VM 11.0.24
Expected behavior
Should be able to connect with Postgres in Elixir (it is very much needed).
Actual behavior
On connection attempt, the following error returns in Elixir:
BUG PROJECT
https://github.com/jonmdev/postgres_bug
Steps to reproduce
mydb
) already created on Ubuntu terminal as follows:Open another terminal on same system to the directory of the bug project (Elixir project) and run
mix deps.get
to get dependencies, theniex -S mix
to start it.See from the Elixir terminal that Postgres does not connect and instead gives the error above.
ELIXIR CODE EXPLANATION
The bug project uses Postgrex which is the primary package for Postgres in Elixir: https://hex.pm/packages/postgrex
Full steps to recreate the bug project (just for reference/understanding of what is in there, many aren't familiar with Elixir):
mix.exs
dependency for postgrex underdefp deps
as{:postgrex, "~> 0.19.2"}
lib/postgres_bug/application.ex
understart
to start the Postgres system and attempt to connect:That is it. That's the whole bug project.
It will keep trying to connect despite the error, and keep reproducing the error repeatedly.
FURTHER INFO
The Postgrex Postgres adapter is explained here: https://hexdocs.pm/postgrex/Postgrex.html#start_link/1
Further parameters that can be added are listed there if needed to the
children
configuration code above likessl:false
. But this in particular doesn't help as this is already the default. I also tried addingparameters: [{:preferQueryMode, "simple" }]
but no help. Perhaps that is not where that would need to go, but we have no other place in Elixir to put it.INSTALLING ELIXIR
If you don't have it, you will of course need to install Erlang/Elixir. Good thing to have in my opinion. 🙂 Instructions are here: https://elixir-lang.org/install.html
I do this with asdf as follows (these are a copy of my own notes I keep for when I have to install it):
You can confirm they are installed by running
erl -version
&elixir -v
REASON NEEDED
Elixir/Erlang is a top class server system with amazing concurrency and fault tolerance. Arcade is the best DB out there. 🙂 They are a great match. HTTP Request is fine for testing (I added the method examples for Elixir in the Arcade docs here a while back). But we need Postgres for better connection maintenance and safety over HTTP Request in real production.
Thank you very much for any help or solutions.
The text was updated successfully, but these errors were encountered: