-
-
Notifications
You must be signed in to change notification settings - Fork 448
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
cannot convert &str to Postgres reg* types #1041
Comments
Those types are aliases of oid, so they would be converted to and from |
@sfackler could you help advise how to add support for these reg types? I would be happy to contribute here. These types are weird. They can be casted to both text and oid. I think in the syntax "select $1::regclass", |
You'd just need to change these two lines to support the other appropriate types: |
I looked a bit into this by writing a test:
I might be missing something but I think we should add support to cast from Thank you! |
How would you propose to do that? |
I am thinking that we would have to modify
and the relevant bits. What do you think? |
The wire format for regclass is a 32 bit unsigned integer. |
Ah right! Let me look into how libpq handles the reg-type family. |
So I think that Now, back to our quest, I think we should implement |
The existing implementations work fairly directly with the postgres binary format of the equivalent type. |
Great! So I guess as you suggested, we can just add
for |
There can only be one impl per type, so you'd need to modify the existing lines. |
A query
select $1::regclass
(textual representation of a table oid) passed an &strtablename
yields the error:It's easy to work around (
select $1::text::regclass
) so I'm raising this issue to document that, but it'd be nice to get the conversions set up for regclass, regtype, regproc, regnamespace, etc!The text was updated successfully, but these errors were encountered: