pg.ddx.io  pgsql-interfaces@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Brian Haney <brian@cybernaut.com>
To: pgsql-interfaces@postgresql.org
Subject: VBA Recordset.AddNew and NOT NULL fields
Date: Tue, 7 Dec 1999 16:58:44 -0800
Message-ID: <001701bf4117$6054d9d0$8101a8c0@specter.fresno.cybernaut.com> (raw)

I have a PostgreSQL (6.5.2) table "vendors" with a serial primary key
"vendor_id".

When I try to add a new record from VBA (under Excel 97, SR-2a) I get

	Run-time error 3155
	ODBC -- insert on linked table '???' failed.

A review of the odbc log file shows that it was trying to execute the
following command:

INSERT INTO  "vendors"
("vendor_id","vendor_name","contact_id","vendor_addr1","vendor_addr2","vendo
r_city","vendor_state","vendor_zip","vendor_country","vendor_email","vendor_
phone","vendor_fax","vendor_promo","vendor_promo_url","vendor_url","vendor_c
omments","last_modified")
VALUES(NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL
,NULL,NULL,NULL)

which of course fails since the primary key, vendor_id, cannot be null.

(The failure message from PostgreSQL was:
"ERROR:  ExecAppend: Fail to add null value in not null attribute
vendor_id".)

I'm using the PostgreSQL ODBC driver 6.40.00.6 from Insight Distribution.

Is it possible to configure the driver or the recordset so it will not
attempt to insert a new record with all NULL values when I invoke the AddNew
method?

Brian Haney




Message-ID: <001701bf4117$6054d9d0$8101a8c0@specter.fresno.cybernaut.com>
Permalink:  ../001701bf4117$6054d9d0$8101a8c0@specter.fresno.cybernaut.com/
Also on:    postgresql.org/message-id/001701bf4117$6054d9d0$8101a8c0@specter.fresno.cybernaut.com

 · 

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-interfaces@postgresql.org
  Cc: brian@cybernaut.com
  Subject: Re: VBA Recordset.AddNew and NOT NULL fields
  In-Reply-To: <001701bf4117$6054d9d0$8101a8c0@specter.fresno.cybernaut.com>
  References: <001701bf4117$6054d9d0$8101a8c0@specter.fresno.cybernaut.com>

* 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