Guest User

Untitled

a guest
May 25th, 2018
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.18 KB | None | 0 0
  1. SELECT column_name FROM information_schema.columns
  2. WHERE table_name = 'table1' AND column_default NOT LIKE 'nextval%'
  3.  
  4. SELECT column_name FROM information_schema.columns
  5. WHERE table_name = 'table1'
  6. AND ( column_default IS NULL OR column_default NOT LIKE 'nextval%')
  7.  
  8. AND (column_default LIKE 'nextval%') IS NOT TRUE;
  9.  
  10. SELECT column_name
  11. FROM information_schema.columns
  12. WHERE table_name = 'hstore1'
  13. AND table_schema = 'public' -- your schema
  14. AND (column_default IS NULL OR
  15. column_default NOT LIKE 'nextval%');
  16.  
  17. SELECT *
  18. FROM pg_catalog.pg_attribute a
  19. WHERE attrelid = 'table1'::regclass
  20. AND NOT attisdropped -- no dropped (dead) columns
  21. AND attnum > 0 -- no system columns
  22. AND NOT EXISTS (
  23. SELECT FROM pg_catalog.pg_attrdef d
  24. WHERE (d.adrelid, d.adnum) = (a.attrelid, a.attnum)
  25. AND d.adsrc LIKE 'nextval%'
  26. AND pg_get_serial_sequence(a.attrelid::regclass::text, a.attname) <> ''
  27. );
  28.  
  29. AND column_default NOT LIKE 'nextval%' OR column_default IS NULL
  30.  
  31. AND NOT column_default LIKE 'nextval%'
  32.  
  33. SELECT column_name *FROM* information_schema.columns
  34. WHERE table_name = 'table1'
  35. AND ( nvl(column_default,0) *NOT LIKE* 'nextval%');
Add Comment
Please, Sign In to add comment