getDefaultTypeName

open override fun getDefaultTypeName(sourceClass: KClass<*>, context: SerializationContext): QualifiedName

Names the PostgreSQL type to declare for the converted value, where nothing else has named one.

Consulted only where convert was given no resolved expectedOid and returned something that does not already carry its own type. Returning null, the default, means the declared type is worked out from the converted value's Kotlin class instead, through the codec registered for it — which is why an unclaimed String always goes out as text.

That default is exactly what a converter producing a stand-in type has to override. An enum converter returns a String, and left alone it would be declared text, which PostgreSQL will not accept where an enum type is wanted; naming the enum type here is what gets the value declared as mood rather than text.

Return

The type to declare, or null to let the converted value's own codec decide.

Parameters

sourceClass

The class of the value being sent, before conversion.

context

Access to the type manager.