Project

General

Profile

« Previous | Next » 

Revision 12874

fix: schemas/util.sql: trim(): by default, cascadingly drop dependent columns so that they don't prevent trim() from succeeding. note that this requires the dependent columns to then be manually re-created.

View differences:

trunk/schemas/util.sql
3750 3750

  
3751 3751

  
3752 3752
--
3753
-- Name: trim(regclass, regclass); Type: FUNCTION; Schema: util; Owner: -
3753
-- Name: trim(regclass, regclass, boolean); Type: FUNCTION; Schema: util; Owner: -
3754 3754
--
3755 3755

  
3756
CREATE FUNCTION "trim"(table_ regclass, names regclass) RETURNS void
3756
CREATE FUNCTION "trim"(table_ regclass, names regclass, force boolean DEFAULT true) RETURNS void
3757 3757
    LANGUAGE sql
3758 3758
    AS $_$
3759
SELECT util.drop_column(($1, col)) FROM util.added_cols($1, $2) f (col);
3759
SELECT util.drop_column(($1, col), $3) FROM util.added_cols($1, $2) f (col);
3760 3760
SELECT NULL::void; -- don't fold away functions called in previous query
3761 3761
$_$;
3762 3762

  
3763 3763

  
3764 3764
--
3765
-- Name: FUNCTION "trim"(table_ regclass, names regclass); Type: COMMENT; Schema: util; Owner: -
3765
-- Name: FUNCTION "trim"(table_ regclass, names regclass, force boolean); Type: COMMENT; Schema: util; Owner: -
3766 3766
--
3767 3767

  
3768
COMMENT ON FUNCTION "trim"(table_ regclass, names regclass) IS '
3769
trims table_ to include only columns in the original data.
3770
idempotent.
3768
COMMENT ON FUNCTION "trim"(table_ regclass, names regclass, force boolean) IS '
3769
trims table_ to include only columns in the original data
3770

  
3771
by default, cascadingly drops dependent columns so that they don''t prevent
3772
trim() from succeeding. note that this requires the dependent columns to then be
3773
manually re-created.
3774

  
3775
idempotent
3771 3776
';
3772 3777

  
3773 3778

  

Also available in: Unified diff