Received: from localhost (maia-3.hub.org [200.46.204.184]) by postgresql.org (Postfix) with ESMTP id 3F0979FB86D for ; Thu, 17 May 2007 14:15:16 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.184]) (amavisd-maia, port 10024) with ESMTP id 06288-04 for ; Thu, 17 May 2007 14:14:38 -0300 (ADT) X-Greylist: delayed 00:27:03.280959 by SQLgrey-1.7.5 Received: from svr4.postgresql.org (svr4.postgresql.org [66.98.251.159]) by postgresql.org (Postfix) with ESMTP id DA6959FB7D1 for ; Thu, 17 May 2007 14:15:06 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.3 Received: from guelah.shrubbery.net (guelah.shrubbery.net [198.58.5.1]) by svr4.postgresql.org (Postfix) with ESMTP id 4EE5E5AF024 for ; Thu, 17 May 2007 16:48:03 +0000 (GMT) Received: by guelah.shrubbery.net (Postfix, from userid 7053) id C2BB38655B; Thu, 17 May 2007 16:48:00 +0000 (UTC) Date: Thu, 17 May 2007 09:48:00 -0700 From: john heasley To: pgsql-interfaces@postgresql.org Subject: libpq: NULL in binary parameters Message-ID: <20070517164800.GA27857@shrubbery.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.4.2.2i X-PGPkey: http://www.shrubbery.net/~heas/public-key.asc X-note: live free, or die! X-homer: i just want to have a beer while i am caring. X-Claimation: an engineer needs a manager like a fish needs a bicycle X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.001 tagged_above=0 required=5 tests=BAYES_50=0.001 X-Spam-Level: X-Archive-Number: 200705/35 X-Sequence-Number: 6542 Using binary parameters with libpq (PQexecParams) I am having trouble figuring out how NULL is represented since there does not appear to be a NULLOID. For example, if a table has a varchar column and it IS NULL for a given row, then what I received is a zero-length string (""). Also, while I can insert a NULL varchar simply by setting the value to NULL (or 0), it is not clear how to acheive this with say an integer column. And, is it possible to match NULL using a parameter. I suspect this boils down to, how is NULL represented as a binary parameter? clues?