-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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: list the conversion functions in pg_type #12526
Comments
I also think the names used should be the ones that exist in postgresql and not how cockroachdb choose to name them. For example, Ecto will throw if it encounter a type it does not support and this is directly correlated with the values postgrex report from those columns. And please see the issue I filled regarding int/float precision: #12530 |
This is what it should look like:
20170206: Updated the table for array types |
To illustrate my point regarding the naming of those columns:
I also wonder how arrays will be working given postgres seems to have a single non typed array with oid 2277 -> |
Just to clarify, Postgrex is not using those function names only to provide end user extension points but it maps itself on them to provide encoders / decoders for all types. Given those tables exists for ORM compatibility only and are not meant to be used internally, I believe it should match postgresql types naming as to not confuse ORMs. |
I've been exploring solutions to this issue.
|
Hi @knz, the issue is, as soon as Postgrex encounter a Conceptually, what is the issue with mapping on names already defined by Postgresql ? |
Hi @knz , any update on this issue ? I am particularly interested on how to deal with typed arrays given postgresql has only one oid for arrays and postgrex is mapping solely on that. Right now i have a few queries that crash with things like |
Hi @jordanlewis, your PR is definitely solving part of the problem but until the correct On the typed arrays, I actually was mistaken when I said Postgres does not have typed arrays, I dont really know how I missed that but actually any typname starting with an So looks like once the |
For clarification on the strictness of sticking with Postgres |
Thank you @tlvenn for the information. Just to be clear, it's my understanding that all we must provide is the proper string names of these send and receive functions in each of the rows of We have no plans to actually implement any of these send and receive builtins, as they are truly internal to Postgres. |
Hi @jordanlewis, yes your understanding is correct, matching entries with postgres in pg_type is all what is needed. |
For typed arrays to work, the Should I open a separate issue for this ? |
Okay - yes, please open a separate issue. Thanks! |
Done in #13524 |
@tlvenn I'm worried that this is not as straightforward as it seems. In Postgres, the That gives us two options, assuming we don't want to implement this special kind of type: represent the column as a string, or represent the column as an OID, which will show up as an integer. Both of these options seem slightly problematic to me. What happens if your program gets the integer form of an OID in the relevant queries? I assume it'll break, right? On the other hand, if we change these columns to string types and just return the names of the builtins, we run the risk of breaking other programs that assume they can join that field against pg_proc. Thoughts? Is there some way we could meet in the middle here? Why exactly do you need to use the |
Pulling in @fishcakez, who can probably better shed some light on this. Postgrex is indeed expecting strings for |
Postgrex uses strings because multiple However it is possible to hook into Postgrex type handling to override the encode/decode for any The maintainers of Postgrex think its type handling is a key feature of the client and a great benefit compared to the behaviour of other clients so is not going to change in this regard unfortunately. |
Thanks for the info guys! It seems like we'll need to actually implement the |
Hi @jordanlewis, it seems you have merged support for |
Yes, I believe that is correct! Adding these fields should be pretty simple, if a bit tedious. They'll need to be matched by corresponding entries in the |
Thanks for the update @jordanlewis |
Hi @jordanlewis, any chance to close that issue soon? It's kinda the last mile to be able to use the stock Postgrex driver. Thanks a lot in advance. |
Hi @tlvenn, we've been quite busy with preparing for our 1.0 release, so I haven't gotten to this. Sorry for the delay! This is still on my plate, and I still hope to get to it soon. |
@tlvenn please let us know if you're encounter further difficulties here as I'm not yet entirely confident that all of the details of the table are properly filled in. |
Hi @jordanlewis, thanks a lot for this. This looks pretty good but there is still one tiny issue remaining with array typnames. Right now a |
I also encountering the following error now:
Seems like there is a slight regression with the work you did to properly support the OID type. |
I have created a dedicated issue for the array typname: #14556 |
Reported in #5582 (comment):
Explained further in #5582 (comment)
The columns "typsend" "typreceive" etc should list the names of conversion functions to/from that data type.
Although we do not support these functions yet it would be useful to fill the columns with the names of these functions nonetheless, so that the client application can do something useful with them (e.g. in the case of Postgrex, run client-side callbacks with the same names).
The text was updated successfully, but these errors were encountered: