[physical][postgresql] concat|| operator (#2945)

Use `||` standard concatenation instead of the `concat` function in
order to use the `vault_kv_store` index on `parent_path`.
This commit is contained in:
Yann 2017-07-02 18:56:18 -04:00 committed by Jeff Mitchell
parent 711d6e6569
commit 27ca1c40c2

View file

@ -72,7 +72,7 @@ func newPostgreSQLBackend(conf map[string]string, logger log.Logger) (Backend, e
delete_query: "DELETE FROM " + quoted_table + " WHERE path = $1 AND key = $2",
list_query: "SELECT key FROM " + quoted_table + " WHERE path = $1" +
"UNION SELECT DISTINCT substring(substr(path, length($1)+1) from '^.*?/') FROM " +
quoted_table + " WHERE parent_path LIKE concat($1, '%')",
quoted_table + " WHERE parent_path LIKE $1 || '%'",
logger: logger,
}