Search Postgresql Archives

Re: Function not inserting rows

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Aug 23, 2017 at 8:23 AM, Frank Foerster <ivaypoint@xxxxxxxxx> wrote:

        sql = "select * from api_dev.add_texts_to_item( %s, %s ); x x"
i get the following python-error:
psycopg2.ProgrammingError: FEHLER:  Syntaxfehler bei »s«
LINE 1: ...dd_texts_to_item( 1234, ARRAY['PSYCOPG1', 'PSYCOPG2'] ); s s

But the created statement looks syntax-wise identical to the pgadmin-statement (except for the forced error of course):

select * from api_dev.add_texts_to_item( 444, array['PGADM1', 'PGADM2'] );


Try adding the following to your function to see what your function sees as being the value of the p_item_texts argument.

RAISE ERROR '%', p_item_texts;

I'm assuming that:

self.cur_.execute( sql, (doc_id, isins, ) )

performs dynamic string substitution as opposed to generating a prepared statement.  The placeholder values supplied to a prepared statement are treated as literals.

You may also want turn on statement logging in the server.

David J.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]

  Powered by Linux