Skip to content

Instantly share code, notes, and snippets.

View guoweihua1982's full-sized avatar

GuoWeiHua guoweihua1982

  • サンネット株式会社
  • Tokyo
View GitHub Profile
@guoweihua1982
guoweihua1982 / PostgreSQL.sql
Created July 10, 2019 06:00
Useful PostgreSQL SQL
-- show all tables and columns and type definitions
SELECT s.schemaname,s.relname,a.attname,format_type(a.atttypid, a.atttypmod)
FROM pg_attribute a
INNER JOIN pg_stat_user_tables s ON s.relid = a.attrelid
WHERE a.attnum > 0
ORDER BY 1,2,3