Re: am I doing something wrong or is this a bug

Chris Cogdon <[email protected]>
Newsgroups gmane.comp.python.db.psycopg.devel
Message-ID <[email protected]>
On Jan 10, 2008, at 20:58 , johnf wrote:

> tempCursor.execute("Select pg_get_serial_sequence('%s','%s') as seq  
> " %
> ('public.arcust','pkid'))
>
> rs = tempCursor.fetchall()
> rs
> [(None,)]
>
> it should return 'public.arcust_pkid_seq'

This many not make a difference to your problem, but you're using the  
API incorrectly. Do this, instead:

tempCursor.execute ( "Select pg_get_serial_sequence ( %s, %s ) as  
seq", ( 'public.arcust', 'pkid' ) )


Notice how I'm NOT enclosing the %s in quotes, nor am I using the  
python % operator.

If you don't do this across your entire application, you're opening  
your application to SQL-injection attacks. Very bad :)



-- 
Chris Cogdon       <[email protected]>                         
Chris:  650 242 3518
Truviso Inc.           http:// 
www.truviso.com                              Switch: 650 242 3500
1065 E Hillsdale Blvd Suite 230 Foster City CA 94404     Fax:    650  
242 3501
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.