For a really clean solution you would want to create a composite type.
SELECT COALESCE ( (SELECT ROW(...,...,...)::type FROM ...), ROW(val,val,val)::type )
You can make use of an anonymous/record type here but you will then be unable to expand it back into individual columns.
The "ROW" is optional but makes it clear in examples like this what is intended.
see the CREATE TYPE documentation for the syntax to create a custom composite type.
David J.
View this message in context:
Re: How to return a default value if no result Sent from the
PostgreSQL - novice mailing list archive at Nabble.com.