go-gorm / go-gorm/postgres

Postgres concurrent index option no longer works

Open
#293 0 comments 4 reactions 1 assignee Claimed by @jinzhu View on GitHub
Dominant language
Go
Stars
297
Forks
155
Avg merge
27m
Merged PRs (30d)
2

Description

## GORM Playground Link

https://github.com/go-gorm/playground/pull/778

## Description

Trying to create a Postgres index concurrently. Followed the directions from the docs https://gorm.io/docs/indexes.html by adding `,options:CONCURRENTLY`. This resulted in an error creating the table.

https://github.com/go-gorm/postgres/pull/288 causes `CONCURRENTLY` to be appended to the end of the create index command. This is clearly invalid. That change did not test the case for `CONCURRENTLY` and thus didn't find that it is now broken.

So I reproduced it 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/postgres@v1.5.11/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)

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.