Ticket #3636 (closed defect: fixed)
Incorrect query in ogrpgtablelayer.cpp (more than one row returned by a subquery used as an expression)
|Reported by:||gabrimonfa||Owned by:||warmerdam|
The following query, executed while fetching the name of the parent table is not correct if there exists two (or more) tables with the same name in different schemas:
osCommand.Printf("SELECT pg_class.relname FROM pg_class WHERE oid = "
"(SELECT pg_inherits.inhparent FROM pg_inherits WHERE inhrelid = " "(SELECT pg_class.oid FROM pg_class WHERE relname = '%s'))", (pszSqlGeomParentTableName) ? pszSqlGeomParentTableName : pszTableIn );
The most inner query, "SELECT pg_class.oid FROM pg_class WHERE relname = '%s'" is used as an expression but in that case it returns two or more rows.
Thus postgresql log complains that
CEST ERROR: more than one row returned by a subquery used as an expression
The query should be modified to target only the table in the schema of interest.
This problem applies at least to 1.7.2 and below until 1.5.2