pg.ddx.io  pgsql-interfaces@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Richard Jones <rich@annexia.org>
To: pgsql-interfaces@postgresql.org
Subject: Find out if a parameter/return field is NULLABLE using Describe
Date: Mon, 30 Jan 2006 20:38:22 +0000
Message-ID: <20060130203822.GA16111@furbychan.cocan.org> (raw)


It doesn't seem to be possible to find out if a parameter or result
field is nullable using the Describe protocol.

For example if I have this table and statement:

  create table employees (
    id serial not null primary key,
    name text not null,
    email text                            <-- this field
  );

  insert into employees (name, email) values ($1, $2);

Then the only information I get back about $2 is that it's a TEXT (OID
= 25), when clearly $1 and $2 are different in that one is nullable
and the other isn't.

Similarly,

  select name, email from employees;

This time I get more information about the types, including a modifier
and length, but I can't see whether that lets me find out that one
could be NULL and the other can never be.

So is this possible?

Rich.

-- 
Richard Jones, CTO Merjis Ltd.
Merjis - web marketing and technology - http://merjis.com
Team Notepad - intranets and extranets for business - http://team-notepad.com



view thread (3+ messages)  latest in thread

Message-ID: <20060130203822.GA16111@furbychan.cocan.org>
Permalink:  ../20060130203822.GA16111@furbychan.cocan.org/
Also on:    postgresql.org/message-id/20060130203822.GA16111@furbychan.cocan.org

 · 

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 using the --to and --cc options:
  reply via email

  To: pgsql-interfaces@postgresql.org
  Cc: rich@annexia.org
  Subject: Re: Find out if a parameter/return field is NULLABLE using Describe
  In-Reply-To: <20060130203822.GA16111@furbychan.cocan.org>

* 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