fix
[libpgclient.git] / types.sh
blob1115b6ca376d20103de62a3aa591bb1bf064cc94
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','Z') order by oid" | 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__