bg
[libdbw.git] / types.sh
bloba35793824b306b06cb8da3b5ef521e2c042c1ecb
1 #!/bin/bash
3 DBNAME=postgres
5 echo "#ifndef" __PGCONSTS_H__
6 echo "#define" __PGCONSTS_H__
7 echo ""
9 psql -d $DBNAME -c "select '@', oid, typname from pg_type where typcategory in ('I','B','U','S','N','E','D','V','T') and typname not in ('name') order by typname" | grep "@" | while read L
11 OID=`echo $L | awk '{print $3}'`
12 NAME=`echo $L | awk '{print toupper($5)}' | sed "s/_T//"`
13 echo "#define OID_$NAME $OID"
14 done
16 echo ""
17 echo "#endif" // __PGCONSTS_H__