Re: Renaming sequence auto generated by SERIAL type don't update pg_attrdef

From: Tom Lane
Subject: Re: Renaming sequence auto generated by SERIAL type don't update pg_attrdef
Date: ,
Msg-id: 21151.1236657248@sss.pgh.pa.us
(view: Whole thread, Raw)
In response to: Re: Renaming sequence auto generated by SERIAL type don't update pg_attrdef  (Oliver Jowett)
Responses: Re: Renaming sequence auto generated by SERIAL type don't update pg_attrdef  (Oliver Jowett)
List: pgsql-jdbc


Oliver Jowett <> 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


pgsql-jdbc by date:

From: Guillaume Cottenceau
Date:
Subject: Re: [PERFORM] Query much slower when run from postgres function
From: "Dickson S. Guedes"
Date:
Subject: Re: Renaming sequence auto generated by SERIAL type don't update pg_attrdef