Relation name '*__dbt_tmp' is longer than 63 characters
See original GitHub issueDescribe the bug
My view name is pretty long, but it is less than 63 characters.
When dbt adds the __dbt_tmp
suffix, it goes over the limit of 63 chars.
The following error is thrown by PostgreSQL:
Relation name ‘foo__dbt_tmp’ is longer than 63 characters
Steps To Reproduce
- Use a view name that is 63 characters long.
dbt run
Expected behavior
To work anyways.
Screenshots and log output
See above.
System information
Which database are you using dbt with?
- postgres
- redshift
- bigquery
- snowflake
- other (specify: ____________)
The output of dbt --version
:
Using Docker image fishtownanalytics/dbt:0.18.1
.
The operating system you’re using:
Using Docker image fishtownanalytics/dbt:0.18.1
.
The output of python --version
:
Using Docker image fishtownanalytics/dbt:0.18.1
.
Additional context
Perhaps the temporary name can be truncated by the length of the suffix to make sure it fits within the limits?
Issue Analytics
- State:
- Created 3 years ago
- Reactions:2
- Comments:9 (6 by maintainers)
Top Results From Across the Web
variable name length exceeds 63 characters - MATLAB Answers
Your demand for more than 63 characters sounds, like you store important values in the name instead of the contents of a variable....
Read more >PostgreSQL's Max Identifier Length Is 63 Bytes
Postgres warns us of identifiers longer than 63 characters, informing us of what they will be truncated to. It then proceeds to create...
Read more >Index name "index_name" is too long; the limit is 63 characters
The system uses no more than NAMEDATALEN-1 bytes of an identifier; longer names can be written in commands, but they will be truncated....
Read more >CUY-90-14.90
Enhanced structural durability for longer service life. A progressive approach to storm water management and best management practices (BMPs).
Read more >Make sure that the identifiers are not more the 63 characters ...
+ * PostgreSQL allows in standard configuration no longer identifiers than 63 + * chars for table/relation names, indexes, primary keys, and ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Regarding the proposal of truncating the model name, I see a potential overlapping issue: you could have 2 models running in parallel, with a long common prefix in the name. If we truncate the model name, the tmp tables created by dbt could end up having exactly the same name. An alternative could be to completely loose the name link between the model name and the temp table name, using some kind of unique short identifier (e.g. an hash of the model name).
@danielefrigo A hash of the model name makes a lot of sense to me! I’d still like to keep the conventional suffixes (
__dbt_backup
,__dbt_tmp
) as well, for clarity of ownership.