Revision 14127
Added by Aaron Marcuse-Kubitza over 10 years ago
trunk/schemas/util.sql | ||
---|---|---|
860 | 860 |
-- |
861 | 861 |
|
862 | 862 |
CREATE FUNCTION cluster_once(table_ regclass, index regclass) RETURNS void |
863 |
LANGUAGE plpgsql STRICT
|
|
863 |
LANGUAGE sql
|
|
864 | 864 |
AS $_$ |
865 |
BEGIN |
|
866 |
IF util.cluster_index(table_) IS DISTINCT FROM index THEN |
|
867 |
-- not yet clustered |
|
868 |
PERFORM util.eval($$CLUSTER $$||table_||$$ USING $$||quote_ident(util.name(index))); |
|
869 |
END IF; |
|
870 |
END; |
|
865 |
SELECT CASE |
|
866 |
WHEN util.cluster_index($1) IS DISTINCT FROM $2 THEN -- not yet clustered |
|
867 |
util.eval($$CLUSTER $$||table_||$$ USING $$||quote_ident(util.name(index))) |
|
868 |
END |
|
871 | 869 |
$_$; |
872 | 870 |
|
873 | 871 |
|
Also available in: Unified diff
schemas/util.sql: cluster_once(): use simpler `LANGUAGE sql` now that we're using util.eval() instead of EXECUTE