Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.92) (envelope-from ) id 1jBSPj-0001LI-7n for pgsql-general@arkaria.postgresql.org; Tue, 10 Mar 2020 00:06:28 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1jBSPh-0007ND-RP for pgsql-general@arkaria.postgresql.org; Tue, 10 Mar 2020 00:06:25 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1jBSPf-0007N6-Pn for pgsql-general@lists.postgresql.org; Tue, 10 Mar 2020 00:06:25 +0000 Received: from [66.111.4.29] (helo=out5-smtp.messagingengine.com) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jBSPX-0001bE-IZ for pgsql-general@postgresql.org; Tue, 10 Mar 2020 00:06:23 +0000 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id AE1CC2227E; Mon, 9 Mar 2020 20:06:03 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Mon, 09 Mar 2020 20:06:03 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aklaver.com; h= subject:to:references:from:message-id:date:mime-version :in-reply-to:content-type:content-transfer-encoding; s=fm2; bh=G CBlI1uJFKIJmL4i28eEab+2FDfbhocS92J9XjW5dIs=; b=BlE6a4krHRn6SQTc3 voFOyVrRT5fw1jAC6QaZC2r9CYQ8e7q1GI1Go2WhbTRRjYgixJwWK9QUbnEeJ80m 0qfe8gSvd3ZVGb7d40hSSfIJQrHRzm1mGo/8/nwZ53LXF5V+2O/fZFNfNEoTzW4+ P3iepHsM6qyf8jwII4HOPOuP//ccQwWMbhvWgALFfyr9AmZpPJO0L7LGxye2O7eR eR17ZgqCNQD0ejM+PX0717sTeWetLt+NRMhL1zfZ7xKPT1gtkzTGC/6+PI+KUp5c uSNJ0R6Kmz24XkMxXuI9yX4pdKwKDjvugxfA4P7WI/EQlFPG1Rj0mAkS6bx1oXr9 BADoA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm2; bh=GCBlI1uJFKIJmL4i28eEab+2FDfbhocS92J9XjW5d Is=; b=c/3LTzjSNZGUkt3ty7MgsSEDQRkZR9EsZIdr2gKyM31YOU/wwI2vI+c85 IWMLz2WltBYxFAWXvjE7QljrkupagKVl50uJ8lYdN1kn+9bNM2vE0mrb9NUbSXfq DgcPjbkvnD2cx7R/rEKfcJOFFH5xquFe4B/KAFmUt/Z1L+mqc+3TBLrJZgSF63vt o5yGM8JNoxHWpVcBQtN9kOQ68ZRNzCAwFQ+pO94ag+bBMPJmRNjeZ/rocQ2zptI7 KjhQ0IywfBezL6EefNzOLTB6kyai4AImjU/KluUWmVqBxn4XxRmPoCbFTlhN8efx l/mRXBPV5YseK/dG4aHXKLtZ3u9Ag== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedugedrudduledgudejucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepuffvfhfhkffffgggjggtgfesthekredttdefjeenucfhrhhomheptegurhhi rghnucfmlhgrvhgvrhcuoegrughrihgrnhdrkhhlrghvvghrsegrkhhlrghvvghrrdgtoh hmqeenucfkphepjedurddvuddvrdduvdelrdduleefnecuvehluhhsthgvrhfuihiivgep tdenucfrrghrrghmpehmrghilhhfrhhomheprggurhhirghnrdhklhgrvhgvrhesrghklh grvhgvrhdrtghomh X-ME-Proxy: Received: from [192.168.1.10] (unknown [71.212.129.193]) by mail.messagingengine.com (Postfix) with ESMTPA id 0534F30611FB; Mon, 9 Mar 2020 20:06:02 -0400 (EDT) Subject: Re: libpq prepared statement insert null for foreign key To: Ted Toth , pgsql-general References: From: Adrian Klaver Message-ID: <8346ce59-d007-a3f9-6ad4-c197ba3d393e@aklaver.com> Date: Mon, 9 Mar 2020 17:06:02 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.5.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit X-Host-Lookup-Failed: Reverse DNS lookup failed for 66.111.4.29 (deferred) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk 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