On 05/23/2018 07:59 PM, tango ward wrote:



On Thu, May 24, 2018 at 10:51 AM, Adrian Klaver

    Try the example I showed previously. If you do not want to use the
    the named parameters e.g %(name)s then use use %s and a tuple like:

    '''
    INSERT INTO my_table(%s, %s)
    WHERE NOT EXISTS(SELECT name FROM my_table WHERE name= %s)
    ''', (Scott', 23, 'Scott'))





        Trying to coordinate with Lead Dev about adding Index On The Fly





-- Adrian Klaver
    adrian.kla...@aklaver.com <mailto:adrian.kla...@aklaver.com>


Thank you Master, the name=%s solved it.

Please show the complete example that worked for completeness.

FYI, psql is your friend. When I work out queries I try them in psql first and then move up to whatever interface I will be using. This is usually done on a dev server so mistakes don't bring things down. If I have to work on a production instance then I do:
BEGIN;
some_query;
ROLLBACK;


--
Adrian Klaver
adrian.kla...@aklaver.com

Reply via email to