how to get sequence alter query for all tables in postgresql -


While following my past - I change the sequences for all my tables below (100+) Need to write scripts is an example for table gcompany

  company-owned sequence seq_gcompany_id company ID;   

How to get the alter query for all the sequence ?

sign : All the names of the names start with seq_g

Try it out.

  select 'change sequence' || _seq || '_table _' is owned by. '|| _column || '; "The (SELECT n.nspname as _schema, c.relname as _table, a.attname AS _column, SUBSTRING (d.adsrc FROM E'nextval \\ ( '' ([^ '']] +) ' '') as _seq pg_attrdef the pg_attrdef aS dot Jane pg_attribute as on a.attrelid = d.adrelid and a.attnum = d.adnum JOIN pg_class aS c on. C .oid = d.adrelid JOIN pg_namespace as n on n .oid = as c.relnamespace WHERE adsrc  pgScript  

Read to perform output 'nextval (' '%') T; < / code>

and


Comments

Popular posts from this blog

Member with no value in F# -

java - Joda Time Interval Not returning what I expect -

c# - Showing a SelectedItem's Property -