Skip to content
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

Demonstrate Postgres concurrent index error #778

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

dashrews78
Copy link

@dashrews78 dashrews78 commented Dec 9, 2024

I was researching how to create postgres indexes concurrently. The documents clearly state to add it to the options. This can be seen in the docs:
https://gorm.io/docs/indexes.html

Due to go-gorm/postgres#288 this no longer works.

When I went to do this I received an error. Such as

CREATE INDEX CONCURRENTLY IF NOT EXISTS "field_idx" ON "test_table" USING btree("idx") CONCURRENTLY

So I reproduced it here by stripping down the playground to only run Postgres. I added an index to one of the fields in the model. As you can see from the results the same error was received.

2024/12/09 15:39:33 /home/runner/go/pkg/mod/gorm.io/driver/[email protected]/migrator.go:153 ERROR: syntax error at or near "CONCURRENTLY" (SQLSTATE 42601)
[0.342ms] [rows:0] CREATE INDEX CONCURRENTLY IF NOT EXISTS "owner_id" ON "toys" USING btree("owner_id") CONCURRENTLY
2024/12/09 15:39:33 Failed to auto migrate, but got error ERROR: syntax error at or near "CONCURRENTLY" (SQLSTATE [42](https://github.com/go-gorm/playground/actions/runs/12238964235/job/34138433247?pr=778#step:6:43)601)

@dashrews78 dashrews78 changed the title force error maybe Demonstrate Postgres concurrent index error Dec 9, 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.

1 participant