Escaping `psql --variable` - Mailing list pgsql-general

From Alan Gutierrez
Subject Escaping `psql --variable`
Date
Msg-id 20120529223254.GB3732@gmail.com
Whole thread Raw
Responses Re: Escaping `psql --variable`
List pgsql-general
Surprised that this works:

     echo ":foo" | psql --variable foo="SELECT 1 AS FOO;"  template1

Why doesn't `psql` escape parameters passed in through `--variable`. When I use
a library in other languages, they will escape the variable.

How do I use `psql` from `bash` so that it will escape variables and thwart SQL
injection?

--
Alan Gutierrez - @bigeasy

pgsql-general by date:

Previous
From: Mark Phillips
Date:
Subject: full text searching
Next
From: Tim Uckun
Date:
Subject: Updateable Views or Synonyms.