Project

General

Profile

« Previous | Next » 

Revision 8088

schemas/functions.sql: Added to_global_col_names()

View differences:

schemas/functions.sql
550 550

  
551 551

  
552 552
--
553
-- Name: to_global_col_names(regclass); Type: FUNCTION; Schema: functions; Owner: -
554
--
555

  
556
CREATE FUNCTION to_global_col_names(table_ regclass) RETURNS void
557
    LANGUAGE plpgsql STRICT
558
    AS $_$
559
DECLARE
560
    row record;
561
BEGIN
562
    FOR row IN SELECT * FROM functions.col_global_names(table_::text::regtype)
563
    LOOP
564
        IF row.global_name != row.name THEN
565
            EXECUTE $$ALTER TABLE $$||table_||$$ RENAME $$
566
                ||quote_ident(row.name)||$$ TO $$||quote_ident(row.global_name);
567
        END IF;
568
    END LOOP;
569
END;
570
$_$;
571

  
572

  
573
--
574
-- Name: FUNCTION to_global_col_names(table_ regclass); Type: COMMENT; Schema: functions; Owner: -
575
--
576

  
577
COMMENT ON FUNCTION to_global_col_names(table_ regclass) IS 'idempotent';
578

  
579

  
580
--
553 581
-- Name: join_strs(text, text); Type: AGGREGATE; Schema: functions; Owner: -
554 582
--
555 583

  

Also available in: Unified diff