Received: from localhost (unknown [200.46.208.211]) by mail.postgresql.org (Postfix) with ESMTP id 5FFA563299E for ; Tue, 10 Mar 2009 00:54:18 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.208.211]) (amavisd-maia, port 10024) with ESMTP id 03286-01 for ; Tue, 10 Mar 2009 00:54:15 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by mail.postgresql.org (Postfix) with ESMTP id AEAC2632685 for ; Tue, 10 Mar 2009 00:54:14 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.2/8.14.2) with ESMTP id n2A3s9Vq021152; Mon, 9 Mar 2009 23:54:09 -0400 (EDT) To: Oliver Jowett cc: "Dickson S. Guedes" , pgsql-jdbc Subject: Re: Renaming sequence auto generated by SERIAL type don't update pg_attrdef In-reply-to: <49B5E208.1080205@opencloud.com> References: <1236650119.6410.73.camel@guedes-laptop> <20795.1236655715@sss.pgh.pa.us> <49B5E208.1080205@opencloud.com> Comments: In-reply-to Oliver Jowett message dated "Tue, 10 Mar 2009 16:44:08 +1300" Date: Mon, 09 Mar 2009 23:54:08 -0400 Message-ID: <21151.1236657248@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests=none X-Spam-Level: X-Archive-Number: 200903/46 X-Sequence-Number: 19376 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