Re: Error with ALTER TABLE %s

Federico Di Gregorio <fog-NGVKUo/i/[email protected]> Tue, 04 May 2010 14:05:17 +0200
Newsgroups gmane.comp.python.db.psycopg.devel
Message-ID <[email protected]>
On 04/05/2010 13:54, [email protected] wrote:
> Hi, when I do
> SQL = "ALTER TABLE films ADD COLUMN (%s) text;"
> data = ("test3", )
> cur.execute(SQL,data)
> 
> I get this error,
> 
> LINE 1: ALTER TABLE films ADD COLUMN (E'test3') text;

You can't use bound variables with column (or table, or functions, etc.)
names.

federico

-- 
Federico Di Gregorio                                       fog-NGVKUo/i/[email protected]
 When people say things are a lot more complicated than that, they
  means they're getting worried that they won't like the truth.
                                                    -- Granny Weatherwax

_______________________________________________
Psycopg mailing list
Psycopg-IAPFreCvJWPBWskQ1e/[email protected]
http://lists.initd.org/mailman/listinfo/psycopg
signature.asc (application/pgp-signature, 262 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkvgDYQACgkQvcCgrgZGjeuq/QCcC4mSIm+6uLCyvSNcW/CpCTHw
qxsAoJXfP8LQKEDNECs0DemOjnXzJc5j
=k1+f
-----END PGP SIGNATURE-----