pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Adrian Klaver <adrian.klaver@aklaver.com>
To: Ted Toth <txtoth@gmail.com>
To: pgsql-general <pgsql-general@postgresql.org>
Subject: Re: libpq prepared statement insert null for foreign key
Date: Mon, 9 Mar 2020 17:06:02 -0700
Message-ID: <8346ce59-d007-a3f9-6ad4-c197ba3d393e@aklaver.com> (raw)
In-Reply-To: <CAFPpqQGz7Rk6Nwh-vD2iHdnERz_sOJkV+Z1UxQxTupJfhzq8UA@mail.gmail.com>
References: <CAFPpqQGz7Rk6Nwh-vD2iHdnERz_sOJkV+Z1UxQxTupJfhzq8UA@mail.gmail.com>

On 3/9/20 5:00 PM, Ted Toth wrote:
> I tries setting the parameter for the foreign NULL:
> params[i] = NULL;

I think you will need to show the code previous to the above.

> 
> and I get a 'Key not present in table ...' error. How do I insert a 
> record where I don't have a foreign key yet?
> 
> Ted


-- 
Adrian Klaver
adrian.klaver@aklaver.com





view thread (2+ messages)

Message-ID: <8346ce59-d007-a3f9-6ad4-c197ba3d393e@aklaver.com>
Permalink:  ../8346ce59-d007-a3f9-6ad4-c197ba3d393e@aklaver.com/
Also on:    postgresql.org/message-id/8346ce59-d007-a3f9-6ad4-c197ba3d393e@aklaver.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-general@postgresql.org
  Cc: adrian.klaver@aklaver.com, txtoth@gmail.com
  Subject: Re: libpq prepared statement insert null for foreign key
  In-Reply-To: <8346ce59-d007-a3f9-6ad4-c197ba3d393e@aklaver.com>
  References: <CAFPpqQGz7Rk6Nwh-vD2iHdnERz_sOJkV+Z1UxQxTupJfhzq8UA@mail.gmail.com> <8346ce59-d007-a3f9-6ad4-c197ba3d393e@aklaver.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