8000 allow_null ignored in browse views - multiple field · Issue #310 · eprints/eprints · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
allow_null ignored in browse views - multiple field #310
Open
@drtjmb

Description

@drtjmb

Related to #274 - read this first.

In the case of browsing on a multiple-value field (eg. creators_id), perform_distinctby seems to produce some SQL that will always include NULL values:

SELECT 
    `distinctby_126264504`.`creators_id` AS D0,
    `distinctby_126264504`.`eprintid` AS D1 
FROM 
    `eprint`, 
    `eprint_creators_id` AS `distinctby_126264504`, 
    `eprint_creators_id` AS `eprint_creators_id` 
WHERE 
    `eprint`.`eprintid`=`distinctby_126264504`.`eprintid` 
    AND 
    `eprint`.`eprintid`=`eprint_creators_id`.`eprintid` 
    AND 
    (`eprint`.`metadata_visibility` = 'show' AND `eprint`.`eprint_status` = 'archive' AND ( `eprint_creators_id`.`creators_id` != ''))

This is joining eprint to eprint_creators_id (aliased as distinctby_126264504) and then again to eprint_creators_id. If there is a NULL value in eprint_creators_id this will always appear in the resulting join (the query filters on eprint_creators_id.creators_id != '' but not distinctby_126264504.creators_id != '').

Debugging exactly where this seemingly incorrect SQL is produced will be difficult.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0