pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: darcy@druid.net
To: glenn.sullivan@nmr.varian.com
Cc: herouth@oumail.openu.ac.il
Cc: pgsql-sql@hub.org
Subject: Re: [SQL] Getting datatype before SELECT
Date: Thu, 1 Oct 1998 22:14:24 -0400 (EDT)
Message-ID: <m0zOujg-00006FC@druid.net> (raw)
In-Reply-To: <3613BE6D.215C6663@nmr.varian.com>

Thus spake Glenn Sullivan
> The value I get returned from PQftype() for a varchar is 1043 
> and for an int is 23.
> I am uncomfortable just testing for these values.  I could
> not find in the documentation, what the return values of 
> PQftype() are.  Can anyone point me to that information?

Here's a Python script to generate #defines for a C header.  I'm sure
you can figure out how to convert it for your needs.

#! /usr/local/bin/python
import string

# change this if you have it somewhere else
for l in open("/usr/local/pgsql/src/include/catalog/pg_type.h").readlines():
    tokens = string.split(l)
    if len(tokens) == 0 or tokens[0] != "#define": continue
    if tokens[1] in ('CASHOID', 'INT2OID', 'INT4OID', 'OIDOID', 'FLOAT4OID', 'FLOAT8OID'):
        print l,

-- 
D'Arcy J.M. Cain <darcy@{druid|vex}.net>   |  Democracy is three wolves
http://www.druid.net/darcy/                |  and a sheep voting on
+1 416 424 2871     (DoD#0082)    (eNTP)   |  what's for dinner.



view thread (11+ messages)  latest in thread

Message-ID: <m0zOujg-00006FC@druid.net>
Permalink:  ../m0zOujg-00006FC@druid.net/
Also on:    postgresql.org/message-id/m0zOujg-00006FC@druid.net

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-sql@postgresql.org
  Cc: darcy@druid.net, glenn.sullivan@nmr.varian.com, herouth@oumail.openu.ac.il, pgsql-sql@hub.org
  Subject: Re: [SQL] Getting datatype before SELECT
  In-Reply-To: <m0zOujg-00006FC@druid.net>
  References: <3613BE6D.215C6663@nmr.varian.com> <m0zOujg-00006FC@druid.net>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox