Bruce Momjian <[email protected]> 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
---------------------------(end of broadcast)---------------------------
TIP 5: don't forget to increase your free space map settings