Skip to content

Instantly share code, notes, and snippets.

@rhysallister
Created February 14, 2015 22:53
Show Gist options
  • Save rhysallister/af1ff68b37b7060ea4f9 to your computer and use it in GitHub Desktop.
Save rhysallister/af1ff68b37b7060ea4f9 to your computer and use it in GitHub Desktop.
list columns in a table for postgres
SELECT attrelid::regclass, attnum, attname
FROM pg_attribute
WHERE attrelid = 'gn.primaryline'::regclass
AND attnum > 0
AND NOT attisdropped
ORDER BY attnum;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment