Skip to content

Error on empty sort_id #142

@giovanniborella

Description

@giovanniborella

Failures observed:

  • Unable to create mapfile
  • Unable to view data in GC2 admin
  • Unable to generate metadata

Each of the services til return an error like:

{"success":false,"message":"Unsupported operand types: int - string","code":500}

The cause of this is an empty value in the fieldconf of a featuretype. if the value of "sort_id" is "" (empty string) PHP will fail.

I've used this to find the relevant information in settings.geometry_columns_join:

SELECT 
	_key_,
	key AS json_key, 
	value->>'sort_id' AS sort_id 
FROM settings.geometry_columns_view, jsonb_each(fieldconf::jsonb)
	WHERE value->>'sort_id' IS NULL OR value->>'sort_id' = ''

if your table is very old, fieldconf might not be valid json and the statement will throw errors.

i suggest a check for null/empty values and default to 0 when getting the information.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions