Received: from localhost (unknown [200.46.208.211]) by mail.postgresql.org (Postfix) with ESMTP id 984C16342F5 for ; Mon, 9 Mar 2009 22:55:31 -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 74851-01 for ; Mon, 9 Mar 2009 22:55:21 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from qw-out-2122.google.com (qw-out-2122.google.com [74.125.92.25]) by mail.postgresql.org (Postfix) with ESMTP id 3485F633FB2 for ; Mon, 9 Mar 2009 22:55:25 -0300 (ADT) Received: by qw-out-2122.google.com with SMTP id 5so962689qwd.61 for ; Mon, 09 Mar 2009 18:55:23 -0700 (PDT) Received: by 10.224.80.134 with SMTP id t6mr8358128qak.246.1236650123656; Mon, 09 Mar 2009 18:55:23 -0700 (PDT) Received: from ?189.4.87.136? ([189.4.87.136]) by mx.google.com with ESMTPS id 4sm1218784yxd.30.2009.03.09.18.55.22 (version=SSLv3 cipher=RC4-MD5); Mon, 09 Mar 2009 18:55:23 -0700 (PDT) Subject: Renaming sequence auto generated by SERIAL type don't update pg_attrdef From: "Dickson S. Guedes" To: pgsql-jdbc Content-Type: text/plain Organization: GuedeSoft.net Date: Mon, 09 Mar 2009 22:55:19 -0300 Message-Id: <1236650119.6410.73.camel@guedes-laptop> Mime-Version: 1.0 X-Mailer: Evolution 2.24.3 Content-Transfer-Encoding: 7bit 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/42 X-Sequence-Number: 19372 Hi all, Reproduced in 8.3.6. postgres=# CREATE TABLE test (a serial); NOTICE: CREATE TABLE will create implicit sequence "test_a_seq" for serial column "test.a" CREATE TABLE postgres=# \d test Tabela "public.test" Coluna | Tipo | Modificadores --------+---------+-------------------------------------------------- a | integer | not null default nextval('test_a_seq'::regclass) postgres=# ALTER SEQUENCE test_a_seq RENAME TO seq_test_another; ALTER SEQUENCE postgres=# \d test Tabela "public.test" Coluna | Tipo | Modificadores --------+---------+-------------------------------------------------------- a | integer | not null default nextval('seq_test_another'::regclass) postgres=# \x postgres=# postgres=# -- A sample select used by JDBC Driver for PostgreSQL postgres=# postgres=# SELECT n.nspname, c.relname, a.attname, a.atttypid, a.attnotnull, a.atttypmod, a.attlen, a.attnum, def.adsrc, dsc.description, t.typbasetype, t.typtype postgres-# FROM pg_catalog.pg_namespace n postgres-# JOIN pg_catalog.pg_class c ON (c.relnamespace = n.oid) postgres-# JOIN pg_catalog.pg_attribute a ON (a.attrelid=c.oid) postgres-# JOIN pg_catalog.pg_type t ON (a.atttypid = t.oid) postgres-# LEFT JOIN pg_catalog.pg_attrdef def ON (a.attrelid=def.adrelid AND a.attnum = def.adnum) postgres-# LEFT JOIN pg_catalog.pg_description dsc ON (c.oid=dsc.objoid AND a.attnum = dsc.objsubid) postgres-# LEFT JOIN pg_catalog.pg_class dc ON (dc.oid=dsc.classoid AND dc.relname='pg_class') postgres-# LEFT JOIN pg_catalog.pg_namespace dn ON (dc.relnamespace=dn.oid AND dn.nspname='pg_catalog') postgres-# WHERE postgres-# a.attnum > 0 AND postgres-# NOT a.attisdropped AND postgres-# n.nspname LIKE 'public' AND postgres-# c.relname LIKE 'test' AND postgres-# a.attname LIKE '%' postgres-# ORDER BY nspname,relname,attnum postgres-# ; -[ RECORD 1 ]-------------------------------- nspname | public relname | test attname | a atttypid | 23 attnotnull | t atttypmod | -1 attlen | 4 attnum | 1 adsrc | nextval('test_a_seq'::regclass) description | typbasetype | 0 typtype | b Shouldn't the JDBC driver use another query instead that, since docs alerts[1] to this problem? [1] http://www.postgresql.org/docs/current/static/catalog-pg-attrdef.html Regards, -- Dickson S. Guedes mail/xmpp: guedes@guedesoft.net - skype: guediz http://guedesoft.net - http://planeta.postgresql.org.br