Open starnowski opened 4 years ago
Consider adding the interface (defined just like below), implemented by all the SQLDefinition objects.
interface HasSQLObjectsWithNames {
List<SQLObjectName> getSQLObjectNames();
}
SQLObjectName { String getName();
String getSchema();
}
Create component which will create identifier for postgres objects like functions, policies and constraints.
PostgresIdentifier.produce(String... args)
Example:
producer.produce("is", "user_id", "from", "tenat") == "is_user_id_from_tenant"
The component should truncate the value to maximum length available in Postgres (by default it is 63 characters).
IMPORTANT! Create a component that will be able to check the value of NAMEDATALEN and if it's valid with the maximum value set in component responsible for identifier generation.
https://www.postgresql.org/docs/current/sql-syntax-lexical.html#SQL-SYNTAX-IDENTIFIERS
https://www.postgresql.org/message-id/20041101092011.GA26912%40svana.org
https://til.hashrocket.com/posts/8f87c65a0a-postgresqls-max-identifier-length-is-63-bytes