Received: from malur.postgresql.org ([2a02:16a8:dc51::56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fFgKV-0002jq-IP for pgsql-general@arkaria.postgresql.org; Mon, 07 May 2018 13:37:27 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1fFgKU-0007ev-ML for pgsql-general@arkaria.postgresql.org; Mon, 07 May 2018 13:37:26 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fFgIj-0001Za-FJ for pgsql-general@lists.postgresql.org; Mon, 07 May 2018 13:35:38 +0000 Received: from out3-smtp.messagingengine.com ([66.111.4.27]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fFgIf-0005QJ-AB for pgsql-general@lists.postgresql.org; Mon, 07 May 2018 13:35:35 +0000 Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id F0B1122811; Mon, 7 May 2018 09:35:31 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute6.internal (MEProxy); Mon, 07 May 2018 09:35:31 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aklaver.com; h= content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-sender :x-me-sender:x-sasl-enc; s=fm2; bh=QRTcqvOH9ZJ+xIGwGC1i8Pqk9tMuy WxlP6kd2pmKsdQ=; b=Nb/HTmz4Cvdkquoyt2Je7uaXBSIdkta/H2HiE6bvCvLVk 4/4+x64ZLW5tYQIqgP/1Bd6Z3eqkAGGn9Kggyc7xeqZqq4x8zYV7M0W8IE2O1lZG N7JKxnqGUKZt70RhFwHB59xWEO8wkbaPxXSkfSr6L0RzGVKRxsBjaU0UzwYU7aXH +gBVVdjs/z9UsR0JrORQh1ot41t2dvdJI/Au1Z7XeUqS0m6G/c9tM6LyLqujPglI qnMDj+gTTKKjSY3L/XYzUgUwoolx24yCSbLvfIOQy+9xZFL+Ib4BoBoo+K808Yfm phjiW435+cqFmD21rTTRCqSDb6RH8ORmwe9s8GdQw== 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-sender:x-me-sender:x-sasl-enc; s=fm2; bh=QRTcqv OH9ZJ+xIGwGC1i8Pqk9tMuyWxlP6kd2pmKsdQ=; b=Jj43GHsvmXjUI0NSdiTGsi 7gk2feR9T9k2QCc8OD4tSt1dagY3QOSc+0nIEcXeEGomwRrfeYvm/tgO4odRx0iS UlEazmga1XcBu/M+j8HAbEjwgPnD0/wC2JH+5NhfcS3z0lZBCXh2tAeHgbzntpWG 13AdJFPYfoytDxd4GeflObGOg6hzSMTz8hlDHS1PqmYFEWapa0dtNM6ArGcBdH5y Gw58hoCvLSk7vH4THiy8DlZ3y0Xs8lYPY/y0zvPGWH6oBxNMkalqWG26Gtwcpv39 llyH1IlZZrkoLfObF8TG8FLok7+5RmMQ4yMSzvShkZ8I08BkPwqrD0hHjHnirjRA == X-ME-Sender: Received: from [192.168.1.2] (unknown [71.212.135.74]) by mail.messagingengine.com (Postfix) with ESMTPA id 3D06A10277; Mon, 7 May 2018 09:35:31 -0400 (EDT) Subject: Re: psycopg2.DataError: invalid input syntax for integer: "" To: tango ward , pgsql-general@lists.postgresql.org References: From: Adrian Klaver Message-ID: <95a3e004-ee59-947b-9839-4142ac9174f4@aklaver.com> Date: Mon, 7 May 2018 06:35:30 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.7.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 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 05/06/2018 11:05 PM, tango ward wrote: > Yes, my apologies. > > May I also ask if there's a limitation for the number of timestamp with > timezone fields in a table? > > On Mon, May 7, 2018 at 1:37 PM, David G. Johnston > > wrote: > > Please keep replies on-list, don't top-post, and double-check that > the database table doesn't somehow have an integer column where you > think its text. > > > On Sunday, May 6, 2018, tango ward > wrote: > > Yeah, the error doesn't really explain much. I have tried > putting the string formatter in ' ', still no good. > > On Mon, May 7, 2018 at 12:14 PM, David G. Johnston > > > wrote: > > On Sunday, May 6, 2018, tango ward > wrote: > > Hi, > > There's a mistake in the code, my bad. > > I updated the code into > > |cur_p.execute(""" INSERT INTO a_recipient (created, mod, > agreed, address, honor) VALUES (current_timestamp, > current_timestamp, current_timestamp, %s, %s)""",('', '')) > > > > | > > The code still won't work. The address and honor fields > are textfields in Django models.py. > > > Not sure but I'm thinking you at least need to add single > quotes around the %s symbols.  That doesn't really explain > the integer input error though I'm not familiar with the > exact features of the execute method in Python. They do not need to be quoted: http://initd.org/psycopg/docs/usage.html#passing-parameters-to-sql-queries > > David J. > > > -- Adrian Klaver adrian.klaver@aklaver.com