anse1 / emacs-libpq

An Emacs 25 module for accessing postgres via libpq.
GNU General Public License v3.0
22 stars 4 forks source link

How to UPDATE table SET column = NULL with the NULL as parameter? #25

Open gnusupport opened 2 years ago

gnusupport commented 2 years ago

I would like to provide parameter NULL to:

UPDATE table SET column = $1

And currently providing "NULL" as string does not work. Is there any existing solution?

gnusupport commented 2 years ago
    (rcd-sql "INSERT INTO businesses (businesses_company, businesses_name, businesses_description,
                                          businesses_url, businesses_tag1, businesses_tag2, businesses_tag3)
                  VALUES ($1, $2, $3, $4, $5, $6, $7)"
         cf-db company name description url tag-1 tag-2 tag-3)

If tag-1 above is nil then it would b good for emacs-libpq to understand nil as NULL as there is now way to provide NULL as parameter. It means I have to use format before providing SQL to module.

IMHO it is better providing parameters to module rather than using format.