Project

General

Profile

« Previous | Next » 

Revision 11100

schemas/vegbien.sql: locationevent__contributors(): split into set-returning and array-returning functions. sort results by fullname so there is a predictable ordering (VegBank does not include a sort_order in the observationContributor table).

View differences:

schemas/vegbien.my.sql
422 422

  
423 423

  
424 424
--
425
-- Name: locationevent__contributors__array(int(11)); Type: FUNCTION; Schema: public; Owner: -
426
--
427

  
428

  
429

  
430

  
431
--
425 432
-- Name: make_family_higher_plant_group(); Type: FUNCTION; Schema: public; Owner: -
426 433
--
427 434

  
schemas/vegbien.sql
824 824
-- Name: locationevent__contributors(integer); Type: FUNCTION; Schema: public; Owner: -
825 825
--
826 826

  
827
CREATE FUNCTION locationevent__contributors(locationevent_id integer) RETURNS text[]
827
CREATE FUNCTION locationevent__contributors(locationevent_id integer) RETURNS SETOF text
828 828
    LANGUAGE sql STABLE
829 829
    AS $_$
830
SELECT array_agg(fullname)
830
SELECT fullname
831 831
FROM locationeventcontributor
832 832
LEFT JOIN party USING (party_id)
833 833
WHERE locationevent_id = $1
834
ORDER BY fullname
834 835
$_$;
835 836

  
836 837

  
837 838
--
839
-- Name: locationevent__contributors__array(integer); Type: FUNCTION; Schema: public; Owner: -
840
--
841

  
842
CREATE FUNCTION locationevent__contributors__array(locationevent_id integer) RETURNS text[]
843
    LANGUAGE sql STABLE
844
    AS $_$
845
SELECT array_agg(locationevent__contributors)
846
FROM locationevent__contributors($1)
847
$_$;
848

  
849

  
850
--
838 851
-- Name: make_family_higher_plant_group(); Type: FUNCTION; Schema: public; Owner: -
839 852
--
840 853

  

Also available in: Unified diff