Project

General

Profile

« Previous | Next » 

Revision 10136

schemas/util.sql: added col_comment()

View differences:

schemas/util.sql
569 569

  
570 570

  
571 571
--
572
-- Name: col_comment(col_ref); Type: FUNCTION; Schema: util; Owner: -
573
--
574

  
575
CREATE FUNCTION col_comment(col col_ref) RETURNS text
576
    LANGUAGE plpgsql STABLE STRICT
577
    AS $$
578
DECLARE
579
	comment text;
580
BEGIN
581
	SELECT description
582
	FROM pg_attribute
583
	LEFT JOIN pg_description ON objoid = attrelid
584
		AND classoid = 'pg_class'::regclass AND objsubid = attnum
585
	WHERE attrelid = col.table_ AND attname = col.name
586
	INTO STRICT comment
587
	;
588
	RETURN comment;
589
EXCEPTION
590
	WHEN no_data_found THEN PERFORM util.raise_undefined_column(col);
591
END;
592
$$;
593

  
594

  
595
--
572 596
-- Name: col_default_sql(col_ref); Type: FUNCTION; Schema: util; Owner: -
573 597
--
574 598

  

Also available in: Unified diff