Created
December 27, 2019 09:38
-
-
Save izmailoff/a40ae26837e279fb1f157928f1b36afa to your computer and use it in GitHub Desktop.
Grab all table columns only without any additional information from postgres. Ugly but works for me.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
for t in $(echo '\dt' | psql "$1" | cut -d '|' -f 2 | egrep -v 'List|Name|--|\(') | |
do echo "TABLE: $t" | |
echo "\d $t" | psql "$1" | grep '|' | egrep -v Column | cut -d '|' -f 1 | |
echo | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment