Fix statement for getTableWhereClause method

If you have a role "postgres" in PostgreSQL that is described like this:
```
-- Role: postgres
CREATE ROLE postgres LOGIN
  ENCRYPTED PASSWORD 'md53175bce1d3201d16594cebf9d7eb3f9d'
  SUPERUSER INHERIT CREATEDB CREATEROLE REPLICATION;
ALTER ROLE postgres IN DATABASE sf_test
  SET search_path = "$user", public, access, geographic, rrhh;
```

At the time when I execute the statement (Part of $schema value in the line 348):
```
SELECT string_to_array((select replace(replace(setting,"$user",user),' ','') from pg_catalog.pg_settings where name = 'search_path'),',')
```
I fetch this result:
```
{public," access"," geographic"," rrhh"}
```
Look the space character that is on the start of each string.This error does not match any namespace to which the role has access. This is critical when you have PostgreSQL database and you work with schemas.
parent f0f408c4
...@@ -345,7 +345,7 @@ class PostgreSqlPlatform extends AbstractPlatform ...@@ -345,7 +345,7 @@ class PostgreSqlPlatform extends AbstractPlatform
list($schema, $table) = explode(".", $table); list($schema, $table) = explode(".", $table);
$schema = "'" . $schema . "'"; $schema = "'" . $schema . "'";
} else { } else {
$schema = "ANY(string_to_array((select replace(setting,'\"\$user\"',user) from pg_catalog.pg_settings where name = 'search_path'),','))"; $schema = "ANY(string_to_array((select replace(replace(setting,'\"\$user\"',user),' ','') from pg_catalog.pg_settings where name = 'search_path'),','))";
} }
$whereClause .= "$classAlias.relname = '" . $table . "' AND $namespaceAlias.nspname = $schema"; $whereClause .= "$classAlias.relname = '" . $table . "' AND $namespaceAlias.nspname = $schema";
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment