Re: psycopg2.DataError: invalid input syntax for integer: "" - Mailing list pgsql-general

From tango ward
Subject Re: psycopg2.DataError: invalid input syntax for integer: ""
Date
Msg-id CAA6wQLLi=Q53=i3N5b1QQSm3EgpDH0o9d_-fhmgCt3EXKwAf9g@mail.gmail.com
Whole thread Raw
In response to psycopg2.DataError: invalid input syntax for integer: ""  (tango ward <tangoward15@gmail.com>)
Responses Re: psycopg2.DataError: invalid input syntax for integer: ""
Re: psycopg2.DataError: invalid input syntax for integer: ""
List pgsql-general
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> 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> 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> wrote:
On Sunday, May 6, 2018, tango ward <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.

David J.



pgsql-general by date:

Previous
From: George Neuner
Date:
Subject: Re: CSVQL? CSV SQL? tab-separated table I/O? RENAME COLUMN
Next
From: "David G. Johnston"
Date:
Subject: Re: psycopg2.DataError: invalid input syntax for integer: ""