Skip to content

Instantly share code, notes, and snippets.

@RhysC
Created July 6, 2017 08:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save RhysC/3497dfe5da1d15a210f24a811e1d2963 to your computer and use it in GitHub Desktop.
Save RhysC/3497dfe5da1d15a210f24a811e1d2963 to your computer and use it in GitHub Desktop.
Generate Select * (with column names defined ) in postgres
SELECT 'SELECT ' || string_agg(column_name, ', ') || ' FROM ' || table_name
FROM information_schema.columns
WHERE table_schema='my_schema'
GROUP BY table_name
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment