Postgres I/O parameter binding in Run Query activity

When building a SQL statement with Postgres and using the UiPath Database Activities package you need to construct the statement manually to provide the encompassing single quotation marks that Postgres expects for a value as the parameter binding method does not work.

Postgres needs $1, $2... for parameters.
UiPath does not use this style by default, so you must write queries using $1, $2 and then add parameters in the same order inside the activity.

INSERT INTO mytable (username, age)
VALUES ($1, $2);
Add parameters in this exact order $1 “John” $2 25

Another example :slight_smile:
query = “INSERT INTO mytable (username, age) VALUES ('” + username + "', " + age.ToString + “);”


How Parameterized Queries and Bind Parameters Are Implemented in PostgreSQL for Efficient Query Execution