Description
Description
Since CakePHP v5.4, the PostGIS ) schema appears to be hardcoded to "public" in
src/Database/Schema/PostgresSchemaDialect.php around line 106.
(postgis v3.5 with pg 16)
No problem with cakephp v5.3.6
PostGIS normally allows using a custom schema (e.g. postgis, extensions, etc.).
However, when a custom schema is configured, calling new Entity([]) triggers an SQL error because the geometry type lookup is done only in the "public" schema.
Expected Behavior
CakePHP should respect the configured PostGIS schema and not assume "public".
Actual Behavior
Geometry type resolution fails with an SQL error when PostGIS is installed in a custom schema.
Steps to Reproduce
- Install PostGIS in a custom schema (e.g.
postgis)
- Configure CakePHP to use that schema
- Instantiate an entity:
$entity = new Entity([]);
The SQL Query: (On file src/Database/Schema/PostgresSchemaDialect.php:106)
$sql = <<<SQL
SELECT
f_{$postgisType}_column AS name,
type,
srid
FROM public.{$postgisType}_columns
WHERE f_table_name = ? AND f_table_schema = ? AND f_table_catalog = ?
SQL;
just removing the "public" shema in the sql query seems to solve the problem.
CakePHP Version
5.4.1
PHP Version
8.3
Description
Description
Since CakePHP v5.4, the PostGIS ) schema appears to be hardcoded to
"public"insrc/Database/Schema/PostgresSchemaDialect.phparound line 106.(postgis v3.5 with pg 16)
No problem with cakephp v5.3.6
PostGIS normally allows using a custom schema (e.g.
postgis,extensions, etc.).However, when a custom schema is configured, calling
new Entity([])triggers an SQL error because the geometry type lookup is done only in the"public"schema.Expected Behavior
CakePHP should respect the configured PostGIS schema and not assume
"public".Actual Behavior
Geometry type resolution fails with an SQL error when PostGIS is installed in a custom schema.
Steps to Reproduce
postgis)The SQL Query: (On file src/Database/Schema/PostgresSchemaDialect.php:106)
$sql = <<<SQL
SELECT
f_{$postgisType}_column AS name,
type,
srid
FROM public.{$postgisType}_columns
WHERE f_table_name = ? AND f_table_schema = ? AND f_table_catalog = ?
SQL;
just removing the "public" shema in the sql query seems to solve the problem.
CakePHP Version
5.4.1
PHP Version
8.3