Skip to content

Conversation

@fulghum
Copy link
Contributor

@fulghum fulghum commented Oct 9, 2024

This change allows Doltgres customers to use TEXT columns in secondary indexes and UNIQUE constraints.

MySQL requires that users specify a prefix length when using a TEXT or BLOB column in a secondary index (also in the primary key, but Dolt/GMS doesn't support that currently). PostgreSQL does not have a concept of prefix lengths. Including the full TEXT content in an index introduces problems with our 65kb row size limit and allowing a secondary index to include an address and de-ref it in TupleComparator is a larger/messier change. Implicitly setting a prefix length is a pragmatic way to get the right behavior, without doing the large refactoring to allow secondary indexes to support address-encoded values correctly. That work seems to be required before we can support TEXT columns being used in primary keys, too.

I played with a few ways to structure this behavior difference. My first choice way to refactor out a separate analyzer rule that Doltgres could insert, but that turned into a lot of copy and paste that didn't seem easier to maintain, so I tried adding a EngineType property to Analyzer so that code can be aware of what type of engine it is emulating and switch on that for different behaviors. I may still take another pass at a separate analyzer rule, just to try that approach again – putting that analyzer rule in GMS, instead of in Doltgres, could prevent some of the copy/paste, without having to export additional, small helper functions.

@fulghum
Copy link
Contributor Author

fulghum commented Oct 15, 2024

Closing this and switching to a different approach that requires less changes in GMS

@fulghum fulghum closed this Oct 15, 2024
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