-
Notifications
You must be signed in to change notification settings - Fork 274
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
Composite Type's oid resolving as generic "record" when param to Ecto SELECTs with WHERE #506
Comments
Also happens for e.g. |
Yes, please see #353. They are not currently supported. Contributions are welcome! |
@josevalim I did see that issue fairly early on, but insofar as it describes specifically "If a composite type, such as a table row, changes its types" and talks at length in the frame of types whose definitions are changing, I wasn't worried about that edge case and thought that surely a stable schema should be fine. It was not remotely clear to me that the upshot of that issue was that they are blanket unsupported in this way. I'd consider at least removing the word "safely" from the title of that issue. And ideally add some language about this being unsupported in the README? (the existing section there about OID decimal vs string encoding hints at issues like this, but its implication was deeply unclear to me) I did not know this was not supposed to work. I spent fully 3 hours trying to make sure I wasn't making a mistake in my implementation I also considered (obviously) following the advice of the error message and implementing a full extension as a workaround, but found how to do that altogether less documented than made that seem viable. I could not find a good example anywhere via Google or Github search. Insofar as Postgrex seems in my limited experience to be the go to adapter for Ecto, I think some user friendliness work here could go a long way, though I understand how it gets pushed back. Do you think the EEF would support this work? Anyway, thanks |
Fantastic feedback. I have updated the README and linked issued.
Someone could definitely write a proposal, the biggest question though is finding someone who would do the sponsored work. |
TL;DR
with an
Ecto.Type
which corresponds to a composite type,Repo.insert
andRepo.all
work fine, but as far as I can tell any attempt to select on the composite type column usingRepo.one
,Repo.get_by
crashes as:This seems to be a result of
param_oids
in the Query ending up with a consistently overly-general and non-working type for the relevant parameterI tried to run this down further than that, but I could not for the life of me find my way through the describes and recvs and such in
protocol.ex
to answer the question of how param_oids are determined.Full Repro
thereupon into
iex -S mix
Digging further into that
this is:
❯ psql -d composite_fail -c 'SELECT typname FROM pg_type WHERE oid = 2249' typname --------- record (1 row)
whereas we'd want it to be (and it otherwise is here)
The text was updated successfully, but these errors were encountered: