Add support for PostgreSQL index access methods (gist, spgist, brin, hash)#1053
Draft
dereuromark wants to merge 3 commits into5.nextfrom
Draft
Add support for PostgreSQL index access methods (gist, spgist, brin, hash)#1053dereuromark wants to merge 3 commits into5.nextfrom
dereuromark wants to merge 3 commits into5.nextfrom
Conversation
markstory
reviewed
Mar 22, 2026
Comment on lines
+944
to
949
| // Build USING clause for access method types (gin, gist, spgist, brin, hash) | ||
| $indexType = $index->getType(); | ||
| $usingClause = ''; | ||
| if (in_array($indexType, self::ACCESS_METHOD_TYPES, true)) { | ||
| $usingClause = ' USING ' . $indexType; | ||
| } |
Member
There was a problem hiding this comment.
Being able to create these index types is a nice improvement. Should the creation of these index types be done in cakephp/database though so that we can also reflect these index types? Without the reflection aspect snapshot generation will be lossy.
Member
Author
There was a problem hiding this comment.
With cakephp/cakephp#19369 going into 5.4, do we still already merge this for support now? Until full loss-less support will come in 5.4?
…hash) - Add Index constants for GIN, GIST, SPGIST, BRIN, and HASH access methods - Add opclass option for specifying operator classes on index columns - Generalize PostgresAdapter to support all access method types - Add tests for each new index type - Update documentation with examples for all PostgreSQL index types Refs cakephp/phinx#1823
40da6d3 to
0228d40
Compare
dereuromark
added a commit
to cakephp/cakephp
that referenced
this pull request
Mar 27, 2026
This adds the ability to reflect PostgreSQL index access methods (gin, gist, spgist, brin, hash) when describing indexes. Changes: - Add `accessMethod` property to Index class with constants for PostgreSQL access methods (GIN, GIST, SPGIST, BRIN, HASH) - Update describeIndexQuery() to join pg_am and fetch amname - Update describeIndexes() and convertIndexDescription() to include accessMethod in result for non-btree indexes - Update indexSql() to generate USING clause for non-btree indexes This enables migrations to properly reflect and regenerate indexes that use specialized PostgreSQL access methods. Refs cakephp/migrations#1053
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR adds support for additional PostgreSQL index access methods beyond the existing GIN support:
Additionally, this adds support for specifying operator classes (
opclass) on index columns, which is useful for specialized index configurations like trigram similarity searches withgist_trgm_ops.Changes
Index::GIN,Index::GIST,Index::SPGIST,Index::BRIN,Index::HASHconstantsopclassoption toIndexclass for specifying operator classesPostgresAdapter::getIndexSqlDefinition()to support all access methodsUsage
Refs cakephp/phinx#1823