Skip to content

PostGIS schema forced to "public" since v5.4 → custom schema breaks entity creation #19604

Description

@Jb5150Fr

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

  1. Install PostGIS in a custom schema (e.g. postgis)
  2. Configure CakePHP to use that schema
  3. 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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions