title: Postgresql query in curl
body: <p>I have a Postgresql 9.1 table that includes columns "city", "admin1", and "country". I would like to select unique values with the output format of "city, admin1, country".</p>
  
  <p>I may have multiple entries for New York and Rochester, Minnesota, but I only want one of each. This is to populate an elastic search index and I am using the <a href="https://github.com/jprante/elasticsearch-river-jdbc" rel="nofollow">JDBC river plugin</a></p>
  
  <p>The following SELECT does what I want in PGAdmin3's SQL editor:</p>
  
  <pre><code>SELECT city || ', ' || admin1 || ', ' || country AS city FROM table GROUP BY city, admin1, country;
  </code></pre>
  
  <p>but fails in the following</p>
  
  <pre><code>curl -XPUT 'localhost:9200/_river/nibbel_river/_meta' -d '{
  
             "type" : "jdbc",
             "jdbc" : {
                 "driver" : "org.postgresql.Driver",
                 "url" : "jdbc:postgresql://localhost:5432/table",
                 "user" : "",
                 "password" : "",
             "sql" : "SELECT city || ', ' || admin1 || ', ' || country AS city FROM everything GROUP BY city, admin1, country",
             "poll" : "7d"
             },
             "index" : {
                 "index" : "city",
                 "type" : "everything"
             }
         }'
  </code></pre>
  
  <p>with the error </p>
  
  <pre><code>curl: (6) Couldn't resolve host ' || admin1 || ,'
  curl: (3) [globbing] unmatched close brace/bracket at pos 102
  {"error":"MapperParsingException[Failed to parse [jdbc.sql]]; nested: JsonParseException[Unexpected end-of-input in VALUE_STRING\n at [Source: [B@1192b0c; line: 8, column: 565]]; ","status":400}
  </code></pre>
  
  <p>What is the syntax for this?</p>