libpq: What can and cannot be bound? How to know? - Mailing list pgsql-general

From Dominique Devienne
Subject libpq: What can and cannot be bound? How to know?
Date
Msg-id CAFCRh-8kT2+h7sEy_vSaeogL_rFZHsxCt7Gg7BAXq7gYnSBM0g@mail.gmail.com
Whole thread Raw
Responses Re: libpq: What can and cannot be bound? How to know?  (Laurenz Albe <laurenz.albe@cybertec.at>)
List pgsql-general
For example with [NOTIFY][1]. The doc states:

> Payload: This must be specified as a simple string literal

Does that mean we cannot bind the payload?
I.e. the pseudo code:
```
conn.exec(bind(msg), "NOTIFY {} $1", conn.escapeName(channel));
```
 is invalid? And I must use instead
```
conn.exec("NOTIFY {} {}", conn.escapeName(channel), conn.escapeLiteral(msg))`?
```
I can try, of course, but could there be a obvious way to know what can and cannot be bound, just from the doc?

That would make it easier to deal with SQL injection to be able to bind for example.
And knowing what can be bound would be useful.

pgsql-general by date:

Previous
From: Laurenz Albe
Date:
Subject: Re: strange behavior of .pgpass file
Next
From: Tomas Vondra
Date:
Subject: Re: pb with join plan