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

[Bug] Non-unique indexes in PostgreSQL are not generated #1050

Open
ostefano opened this issue Jan 24, 2024 · 3 comments
Open

[Bug] Non-unique indexes in PostgreSQL are not generated #1050

ostefano opened this issue Jan 24, 2024 · 3 comments

Comments

@ostefano
Copy link

I am using schemahero 0.17.2 and PostgreSql and I see issues when using single column indexes that are not unique.

For example, this works and creates two indexes.

indexes:
- columns:
  - elem_id
  - feature_id
  name: idx_elem_feature
  isUnique: true
- columns:
  - feature_id
  name: idx_feature_id
  isUnique: true

While this one does not, and the second index is not generated:

indexes:
- columns:
  - elem_id
  - feature_id
  name: idx_elem_feature
  isUnique: true
- columns:
  - feature_id
  name: idx_feature_id
  isUnique: false
@rubenhak
Copy link

We are also experiencing this. Looks like the decision making regarding indexes happens here, but couldn't find any mention of isUnique though...

func BuildIndexStatements(p *PostgresConnection, tableName string, postgresTableSchema *schemasv1alpha4.PostgresqlTableSchema) ([]string, error) {

@rubenhak
Copy link

Or is this if index.IsUnique causing the issue?

if index.IsUnique {

@Phat3
Copy link

Phat3 commented Mar 22, 2024

Possible fix #1071

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

No branches or pull requests

3 participants