pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Adrian Klaver <adrian.klaver@aklaver.com>
To: tango ward <tangoward15@gmail.com>
To: pgsql-general@lists.postgresql.org
Subject: Re: psycopg2.DataError: invalid input syntax for integer: ""
Date: Mon, 7 May 2018 06:35:30 -0700
Message-ID: <95a3e004-ee59-947b-9839-4142ac9174f4@aklaver.com> (raw)
In-Reply-To: <CAA6wQLLi=Q53=i3N5b1QQSm3EgpDH0o9d_-fhmgCt3EXKwAf9g@mail.gmail.com>
References: <CAA6wQLJjNYtnXwQR14TtSK2eEAVmxy-zc-Uy1zqQYOF56VqxvQ@mail.gmail.com>
	<CAKFQuwafnE4hCacPP25kcAH6dRzuf7kBdBDd8JJptDBC8PqdLQ@mail.gmail.com>
	<CAA6wQLJF-TYuE5b1gLVaCjmeo+KyL26FwwD_pwNE54CBkkjwEA@mail.gmail.com>
	<CAKFQuwaZX4zLDU0pKr+Hk2H6UDndtVd2XULNvz6o=HPu+f1v3Q@mail.gmail.com>
	<CAA6wQL+mxtYNf6-jYWpqT=WZMEy4ePL1bH+BbYmcO+1FBqdOTA@mail.gmail.com>
	<CAKFQuwZhP9-z7psieZFMbkAFNLzsbjShUBKvF-8ikeQ_JtiSfw@mail.gmail.com>
	<CAA6wQLLi=Q53=i3N5b1QQSm3EgpDH0o9d_-fhmgCt3EXKwAf9g@mail.gmail.com>

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 
> <david.g.johnston@gmail.com <mailto:david.g.johnston@gmail.com>> 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 <tangoward15@gmail.com
>     <mailto:tangoward15@gmail.com>> 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
>         <david.g.johnston@gmail.com <mailto:david.g.johnston@gmail.com>>
>         wrote:
> 
>             On Sunday, May 6, 2018, tango ward <tangoward15@gmail.com
>             <mailto:tangoward15@gmail.com>> 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




view thread (10+ messages)  latest in thread

Message-ID: <95a3e004-ee59-947b-9839-4142ac9174f4@aklaver.com>
Permalink:  ../95a3e004-ee59-947b-9839-4142ac9174f4@aklaver.com/
Also on:    postgresql.org/message-id/95a3e004-ee59-947b-9839-4142ac9174f4@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, tangoward15@gmail.com
  Subject: Re: psycopg2.DataError: invalid input syntax for integer: ""
  In-Reply-To: <95a3e004-ee59-947b-9839-4142ac9174f4@aklaver.com>
  References: <CAA6wQLJjNYtnXwQR14TtSK2eEAVmxy-zc-Uy1zqQYOF56VqxvQ@mail.gmail.com> <CAKFQuwafnE4hCacPP25kcAH6dRzuf7kBdBDd8JJptDBC8PqdLQ@mail.gmail.com> <CAA6wQLJF-TYuE5b1gLVaCjmeo+KyL26FwwD_pwNE54CBkkjwEA@mail.gmail.com> <CAKFQuwaZX4zLDU0pKr+Hk2H6UDndtVd2XULNvz6o=HPu+f1v3Q@mail.gmail.com> <CAA6wQL+mxtYNf6-jYWpqT=WZMEy4ePL1bH+BbYmcO+1FBqdOTA@mail.gmail.com> <CAKFQuwZhP9-z7psieZFMbkAFNLzsbjShUBKvF-8ikeQ_JtiSfw@mail.gmail.com> <CAA6wQLLi=Q53=i3N5b1QQSm3EgpDH0o9d_-fhmgCt3EXKwAf9g@mail.gmail.com> <95a3e004-ee59-947b-9839-4142ac9174f4@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