Reputation: 691
As I found in documentation:
Parenthesized type modifiers (e.g., the precision field for type numeric) are discarded by CREATE FUNCTION
Are there any alternatives to return varchar(N) type from plpgsql function?
question update:
On picture you can see that Name column recognised as varchar(128), however Number column is recognised as nonsized varchar
f_concat function returns: cast(res as varchar(255));
Upvotes: 2
Views: 677
Reputation: 21356
You can preserve the type modifier for a function result by creating a domain. Postgres will use the underlying varchar(N)
type when sending column descriptions to your client:
Upvotes: 4