Re: Encountered an error

From: Karsten Hilbert <Karsten(dot)Hilbert(at)gmx(dot)net>
To: psycopg(at)postgresql(dot)org
Subject: Re: Encountered an error
Date: 2016-03-14 18:30:59
Message-ID: 20160314183059.GB24296@hermes.hilbert.loc
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: psycopg

On Mon, Mar 14, 2016 at 08:41:04PM +0530, Shaan Repswal wrote:

> I tried to format the strings the Python way but... I'm getting this error:-
>
> Traceback (most recent call last):
> File "C:\Python34\prototype_husk.py", line 133, in submit_data
> cur.execute(add_column)
> psycopg2.ProgrammingError: syntax error at or near "26.2"
> LINE 2: ADD 26.2 LTRS int DEFAULT NULL

That is what I have been trying to point out - you can't add
a column named "25.2 LTRS" even if the user entered that
value. You will need code to sanitize user input to become
suitable for column names. I seem to remember you saying you
already have such code ?

Karsten
--
GPG key ID E4071346 @ eu.pool.sks-keyservers.net
E167 67FD A291 2BEA 73BD 4537 78B9 A9F9 E407 1346

In response to

Responses

Browse psycopg by date

  From Date Subject
Next Message Shaan Repswal 2016-03-15 05:15:32 Re: Encountered an error
Previous Message Adrian Klaver 2016-03-14 17:04:30 Re: DELETE FROM statement not working