Re: [PATCHES] Proposed patch for sequence-renaming problems

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
Cc: Peter Eisentraut <peter_e(at)gmx(dot)net>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: [PATCHES] Proposed patch for sequence-renaming problems
Date: 2005-10-01 21:13:40
Message-ID: 28270.1128201220@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches

Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> writes:
> Sorry, this is the right one:

> SELECT n.nspname, c.relname, a.attname, d.adsrc
> FROM pg_namespace n, pg_class c, pg_attribute a, pg_attrdef d
> WHERE n.oid = c.relnamespace AND
> c.oid = a.attrelid AND
> a.attrelid = d.adrelid AND
> a.attnum = d.adnum AND
> d.adsrc ~ '.*nextval\\(''[^'']*''::text\\)';

Doesn't actually work with the finished patch; the adsrc values look
more like
nextval(('seq'::text)::regclass)

> Followed by the appropriate:
> ALTER TABLE sp.test2 ALTER COLUMN x DROP DEFAULT;
> ALTER TABLE sp.test2 ALTER COLUMN x SET DEFAULT nextval('sp.aa');

AFAIK you don't need to bother with the DROP step.

regards, tom lane

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2005-10-01 21:15:25 Re: [HACKERS] Query in SQL statement
Previous Message Tom Lane 2005-10-01 21:01:51 Re: Proposed patch for sequence-renaming problems

Browse pgsql-patches by date

  From Date Subject
Next Message Thomas Hallgren 2005-10-02 07:18:41 Path to enable a module to change the stack_base_ptr
Previous Message Tom Lane 2005-10-01 21:01:51 Re: Proposed patch for sequence-renaming problems