Skip to content

GetRecords with multiple profiles sharing one table returns wrong rows and resolves wrong columns #1268

Description

@lirantul123

When multiple CSW profiles share one repository table (each row tagged by its typename column), GetRecords scoped to a specific profile typename has two bugs:

Bug 1: typename filter not applied

repository.query() accepts a typenames argument but never applies it as a SQL filter. A request for typeNames="foo:RecordA" returns every row in the table, including rows belonging to other profiles.

Filter and CQL property names always resolve against queryables['_all'], a flat merge of all loaded profiles where the last-loaded profile wins. When two profiles define the same property name mapping to different database columns, queries against one profile silently hit the other profile's column.

Steps to reproduce

  1. Configure two profiles (A and B) sharing one table, each row tagged with its typename.
  2. Both profiles define a property with the same name but different dbcol.
  3. Send GetRecords with typeNames="A:Record" and a filter on that property.
  4. Observe: rows from profile B are returned, and the filter hits B's column instead of A's.

Expected behaviour

Only rows whose typename column matches the requested typename are returned, and property names resolve to the correct column for the requested profile.

Affected versions

Reproducible on current master. Both csw2.py (FES 1.0) and csw3.py (FES 2.0) are affected.

Notes

  • csw:Record / csw30:Record wildcards should continue returning all rows (single-profile and default behaviour must remain unchanged).
  • GetRecordById has no typeNames parameter in the spec, so cross-profile record-by-ID is a separate concern.

A fix is ready: https://github.com/lirantul123/pycsw/tree/fix/multiprofile-typename-scoping

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions