research-software-directory / RSD-as-a-service

This repo contains the new RSD-as-a-service implementation
https://research.software
27 stars 14 forks source link

fix: specify return types in category_path #1299

Closed cmeessen closed 2 months ago

cmeessen commented 2 months ago

Fixes #1297

Changes proposed in this pull request:

How to test:

CREATE FUNCTION category_path(category_id UUID) RETURNS TABLE ( id UUID, parent UUID, community UUID, short_name VARCHAR, name VARCHAR, properties JSONB, provenance_iri VARCHAR ) LANGUAGE SQL STABLE AS $$ WITH RECURSIVE cat_path AS ( SELECT , 1 AS r_index FROM category WHERE id = category_id UNION ALL SELECT category., cat_path.r_index+1 FROM category JOIN cat_path ON category.id = cat_path.parent ) -- 1. How can we reverse the output rows without injecting a new column (r_index)? -- 2. How a table row "type" could be used here Now we have to list all columns of category explicitly -- I want to have something like * without 'r_index' to be independent from modifications of category -- 3. Maybe this could be improved by using SEARCH keyword. SELECT id, parent, community, short_name, name, properties, provenance_iri FROM cat_path ORDER BY r_index DESC; $$;


* verify that software page with assigned categories shows categories and that no database errors occur upon viewing

PR Checklist:

*   [ ] Increase version numbers in `docker-compose.yml`
*   [x] Link to a GitHub issue
*   [ ] Update documentation
*   [ ] Tests
sonarcloud[bot] commented 2 months ago

Quality Gate Passed Quality Gate passed for 'rsd-database'

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
0.0% Coverage on New Code
0.0% Duplication on New Code

See analysis details on SonarCloud