Re: [PATCHES] Proposed patch for sequence-renaming problems - Mailing list pgsql-hackers

From Tom Lane
Subject Re: [PATCHES] Proposed patch for sequence-renaming problems
Date
Msg-id 28270.1128201220@sss.pgh.pa.us
Whole thread Raw
In response to Re: [PATCHES] Proposed patch for sequence-renaming problems  (Bruce Momjian <pgman@candle.pha.pa.us>)
List pgsql-hackers
Bruce Momjian <pgman@candle.pha.pa.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 likenextval(('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


pgsql-hackers by date:

Previous
From: Hannu Krosing
Date:
Subject: Re: effective SELECT from child tables
Next
From: Tom Lane
Date:
Subject: Re: [PERFORM] Query in SQL statement