The problem I’m having
I want to override MAX_CHARACTERS_IN_IDENTIFIER constant in my project to 55 instead of 63 which is the default.
The context of why I’m trying to do this
I’m using PostgreSQL with Citus extension. To handle it with dbt I needed to adjust the materialization macro. When dbt creates a temporary table for inserted rows, I make this table distributed for sake of performance. I found that when a table name has more than 55 characters in name when distributing, Citus is throwing an error:
canceling the transaction since it was involved in a distributed deadlock
For a table with 55 it works, when longer is 56 characters and more, the error is thrown.
My model name (I would like to keep the long name for the sake of conversion I have in my project) plus dbt’s temporary table suffix exceeds 55 letters but less than 63.
I spot MAX_CHARACTERS_IN_IDENTIFIER in postgres adapter. Is there a way of overriding its value?
What I’ve already tried
- I tried to slice the variable
temp_relation
in the materialization macro but without success.temp_relation
seems not to be just a string but a complex object. I don’t want to do a lot of changes, so changing a config variable would be a perfect solution for me.