Project

General

Profile

« Previous | Next » 

Revision 8190

schemas/util.sql: Added mk_const_col()

View differences:

schemas/util.sql
723 723

  
724 724

  
725 725
--
726
-- Name: mk_const_col(col_ref, anyelement); Type: FUNCTION; Schema: util; Owner: -
727
--
728

  
729
CREATE FUNCTION mk_const_col(col col_ref, value anyelement) RETURNS void
730
    LANGUAGE sql STRICT
731
    AS $_$
732
SELECT util.create_if_not_exists($$ALTER TABLE $$||$1.table_||$$ ADD COLUMN $$
733
||quote_ident($1.name)||$$ $$||pg_typeof($2)||util.type_qual($2)||$$ DEFAULT $$
734
||quote_literal($2))
735
$_$;
736

  
737

  
738
--
739
-- Name: FUNCTION mk_const_col(col col_ref, value anyelement); Type: COMMENT; Schema: util; Owner: -
740
--
741

  
742
COMMENT ON FUNCTION mk_const_col(col col_ref, value anyelement) IS 'idempotent';
743

  
744

  
745
--
726 746
-- Name: mk_derived_col(col_ref, text); Type: FUNCTION; Schema: util; Owner: -
727 747
--
728 748

  

Also available in: Unified diff