Oliver Jowett <oliver@opencloud.com> writes:
> Tom Lane wrote:
>> What's the default value being used for anyway?
> I'm guessing that particular query is from
> DatabaseMetaData.getColumns(), which returns amongst other things:
> 13. COLUMN_DEF String => default value (may be null)
> (yes, that's the sum total of the JDBC documentation about that piece of
> metadata)
Hmm. The correct, pg_dump-tested way to get the default expression is
pg_catalog.pg_get_expr(adbin, adrelid)
but that's fairly expensive. I'm having a hard time recommending
that you put it into DatabaseMetaData.getColumns, when probably 99.99%
of applications won't even look at the value let alone care if it is
stale. OTOH the joins involved are not-cheap already, so maybe this
worry is just premature micro-optimization.
BTW, is there a reason for the query to be using LIKE 'name' instead of
= 'name'? And if so, is whatever generates it smart about underscores
and % and \ in the name?
regards, tom lane