Project

General

Profile

« Previous | Next » 

Revision 8105

schemas/functions.sql: Added cluster_once()

View differences:

schemas/functions.sql
487 487

  
488 488

  
489 489
--
490
-- Name: cluster_once(regclass, regclass); Type: FUNCTION; Schema: functions; Owner: -
491
--
492

  
493
CREATE FUNCTION cluster_once(table_ regclass, index regclass) RETURNS void
494
    LANGUAGE plpgsql STRICT
495
    AS $_$
496
BEGIN
497
    -- not yet clustered (ARRAY[] compares NULLs literally)
498
    IF ARRAY[functions.cluster_index(table_)] != ARRAY[index] THEN
499
        EXECUTE $$CLUSTER $$||table_||$$ USING $$||index;
500
    END IF;
501
END;
502
$_$;
503

  
504

  
505
--
506
-- Name: FUNCTION cluster_once(table_ regclass, index regclass); Type: COMMENT; Schema: functions; Owner: -
507
--
508

  
509
COMMENT ON FUNCTION cluster_once(table_ regclass, index regclass) IS 'idempotent';
510

  
511

  
512
--
490 513
-- Name: col_global_names(regtype); Type: FUNCTION; Schema: functions; Owner: -
491 514
--
492 515

  

Also available in: Unified diff