db_toff on pggeodb.nancy.inra.fr
Previous topic Chapter index Next topic

View: v_tree_families_characteristic

 

 

Schema

public

 

Owner

postgres

 

Descriptions

View to produce recursively the whole characteristic tree / vue permettant de créer récursivement l'arbre complet des caractéristiques.

 

Fields

Name

Data type

Description

description

varchar(128)

 

id_family

integer

 

id_parent

integer

 

stage

integer

 

path

text

 

 

Rules

Name

Event

Instead

Condition

Description

_RETURN

SELECT

 

 

 

Indices

There are no indices for table v_tree_families_characteristic

 

Definition

CREATE VIEW public.v_tree_families_characteristic (
   description,
   id_family,
   id_parent,
   stage,
   path)
AS
WITH RECURSIVE
trail_family_charac(description, id_family, id_parent, stage, path) AS (
SELECT tr_family_characteristic_fca.fca_wording,
           tr_family_characteristic_fca.fca_id,
           tr_family_characteristic_fca.fca_parent_id,
           0,
           tr_family_characteristic_fca.fca_wording::text AS fca_wording
FROM tr_family_characteristic_fca
WHERE tr_family_characteristic_fca.fca_parent_id IS NULL
UNION ALL
SELECT
fca.fca_wording,
           fca.fca_id,
           fca.fca_parent_id,
           pf.stage + 1,
           
(pf.path || '/'::text) || fca.fca_wording::text
FROM tr_family_characteristic_fca fca
            JOIN trail_family_charac pf ON pf.id_family = fca.fca_parent_id
       )
   SELECT trail_family_charac.description,
   trail_family_charac.id_family,
   trail_family_charac.id_parent,
   trail_family_charac.stage,
   trail_family_charac.path
   FROM trail_family_charac
   ORDER BY trail_family_charac.path;

COMMENT ON VIEW public.v_tree_families_characteristic
IS 'View to produce recursively the whole characteristic tree / vue permettant de créer récursivement l''arbre complet des caractéristiques.';

This file was generated with SQL Manager for PostgreSQL (www.pgsqlmanager.com) at 19/06/2019 10:17
Previous topic Chapter index Next topic