Skip to content

Conversation

@WhiskeyJack96
Copy link

This is pretty rough, but before going through the process to polish it and test it I wanted to get something up to see if this would be accepted (or if theres a "better" way)

@jackc
Copy link
Owner

jackc commented Jan 18, 2025

The fundamental difficulty with scanning by names in composite types is that composite field names are not included over the wire. They are sent positionally. So I don't think it is possible for row(...) or subquery results. I guess it might be possible for specific registered types to use the OID to look up the previously determined field names. I'm guessing that's the approach you are taking? I looked at the code but I didn't quite follow it.

I suppose this might be a reasonable approach to solve the problem. But I actually wonder if the problem needs to be solved. Composites are always returned in a specifically defined order. I just use a struct defined where the position of the fields matches the position of the fields on the PostgreSQL type. I haven't encountered the need for anything past that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants