dbt-labs / dbt-labs/dbt-adapters

[Bug] Cannot create postgres indexes on columns with upper case letters

Open
#1,288 0 comments 0 reactions 0 assignees View on GitHub
triage:product type:bug
Dominant language
Python
Stars
233
Forks
362
Avg merge
3d 22h
Merged PRs (30d)
9

Description

### Is this a new bug?

- [x] I believe this is a new bug
- [x] I have searched the existing issues, and I could not find an existing issue for this bug

### Which packages are affected?

- [ ] dbt-adapters
- [ ] dbt-tests-adapter
- [ ] dbt-athena
- [ ] dbt-athena-community
- [ ] dbt-bigquery
- [x] dbt-postgres
- [ ] dbt-redshift
- [ ] dbt-snowflake
- [ ] dbt-spark

### Current Behavior

I opened an issue on dbt-core, but I think this is more appropriate: https://github.com/dbt-labs/dbt-core/issues/11665

The same issue is also described here:
https://discourse.getdbt.com/t/create-indices-on-a-column-with-camel-casing/11513

I define an index like this:

```
{{ config(
indexes=[
{‘columns’: ["submission_id", “ContractID”]}
]
)}}
```

I get an error:

`column "contractid" does not exist`

Confirmed that adding quoting does not seem to help. In fact the sql shows the column are quoted, but they are lowercased automatically somewhere:

```
create unique index if not exists
"5481a023e379ef5288517c3dc7a90c0a"
on "test"."views"."my_view" using btree
("contractid", "submission_id")
```

### Expected Behavior

I would expect that the cases I include will be preserved

### Steps To Reproduce

Given any postgres database with columns that have upper case characters

### Relevant log output

```shell

```

### Environment

```markdown
- OS: Ubuntu 20.04
- Python: 3.10.12
- dbt-adapters: 1.9.0
- dbt-postgres: 1.9.0
```

### Additional Context

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.