You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We've encountered an issue when using managed: true in our SQLC configuration with PostgreSQL databases.
Problem:
When using local schema parsing (managed: false), SQLC correctly interprets PostgreSQL enum types and generates proper type-safe Go types. However, when we enable managed: true to connect to a real database, the same enum fields are generated as interface{} instead of their strongly-typed equivalents.
For example, with managed: false:
typeCreateDocumentParamsstruct {
ID uuid.UUIDTypeDocumentType// Properly typed enum// ...other fields
}
But with managed: true:
typeCreateDocumentParamsstruct {
ID uuid.UUIDTypeinterface{} // No longer properly typed// ...other fields
}
This happens despite the enum type definitions being present in our migration files that SQLC is using for schema information.
What's the best practice for handling PostgreSQL enum types when using managed mode? It seems unnecessary to manually override types that SQLC could/should detect from the schema. Is there a configuration option we're missing?
We want to use managed: true for its benefits, especially with sqlc vet, but the loss of type safety for enums is problematic.
Any guidance would be appreciated!
The text was updated successfully, but these errors were encountered:
We've encountered an issue when using managed: true in our SQLC configuration with PostgreSQL databases.
Problem:
When using local schema parsing (
managed: false
), SQLC correctly interprets PostgreSQL enum types and generates proper type-safe Go types. However, when we enable managed: true to connect to a real database, the same enum fields are generated asinterface{}
instead of their strongly-typed equivalents.For example, with
managed: false
:But with
managed: true
:This happens despite the enum type definitions being present in our migration files that SQLC is using for schema information.
What's the best practice for handling PostgreSQL enum types when using managed mode? It seems unnecessary to manually override types that SQLC could/should detect from the schema. Is there a configuration option we're missing?
We want to use
managed: true
for its benefits, especially withsqlc vet
, but the loss of type safety for enums is problematic.Any guidance would be appreciated!
The text was updated successfully, but these errors were encountered: