I have this assignment in plpythonu in PostgreSQL function:
result=plpy.execute("select value from table where doctitle like '%%%s%%'"%projectname)
if result:
final = result[0]["value"]
The query can return 1 text result or nothing.
The issue is that if the query returned nothing the if result: condition is still true (Cuz it contains the value column)... I want the assignment to final happen only if there is actual value in value column. How do I check for that?