jakob / jakob/Postico

index auto-name collisions

Open
#539 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
486
Forks
8
PR merge metrics
No merged PRs in 30d

Description

## What did you do?

If you take this table

```sql
CREATE TABLE "public"."test" (
"id" serial,
"flag1" bool NOT NULL DEFAULT 'false',
"flag2" bool NOT NULL DEFAULT 'false',
PRIMARY KEY ("id")
);
```

and use the structure view to create two expression indices like `flag1 = true` and `flag2 = true`. The auto generated names for the indices are both `test_expr_idx`.

## What did you expect to happen?

The index names should be checked for collision with existing indices and the other ones that will be created.

Or the index name should not be specified in the create query (if not explicitly specified by the user) so that postgres takes care of naming them.

## What actually happened?

Save changes fails with `PostgreSQL said: relation "test_expr_idx" already exists`;

## What software versions are you using?

Postico version: 1.3.5
macOS version: 10.13.4
PostgreSQL version: 10.3

Contributor guide

No contributing guide indexed for this repository

Research direction

Reproduce the collision from the Structure view using the reported table and two expression indices, then trace the index-name generation used when saving changes. Done means separately named indices can be created successfully, or unnamed indices are left for PostgreSQL to name, without the relation-already-exists error.

Written by the indexing model from the issue text.

Assessment

Tech stack
postgresql, python
Domain
databases, desktop
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.