Skip to content

Instantly share code, notes, and snippets.

@ccfontes
Created December 8, 2012 02:48
Show Gist options
  • Save ccfontes/4238326 to your computer and use it in GitHub Desktop.
Save ccfontes/4238326 to your computer and use it in GitHub Desktop.
SELECT c.column_name, c.is_nullable, c.character_maximum_length, c.numeric_precision, c.numeric_scale, c.udt_name, tc.constraint_type
FROM ((information_schema.columns as c
INNER
JOIN information_schema.constraint_column_usage as ccu
ON c.column_name = ccu.column_name)
INNER
JOIN information_schema.table_constraints as tc
ON tc.constraint_name = ccu.constraint_name)
WHERE table_name = 'users';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment