Revision 11392
Added by Aaron Marcuse-Kubitza about 11 years ago
schemas/vegbien.sql | ||
---|---|---|
725 | 725 |
|
726 | 726 |
CREATE FUNCTION datasource_publish(datasource text, schema_null anyelement DEFAULT NULL::source) RETURNS void |
727 | 727 |
LANGUAGE plpgsql |
728 |
AS $_$
|
|
728 |
AS $$ |
|
729 | 729 |
DECLARE |
730 |
live_datasource text := rm_version_suffix($1);
|
|
730 |
live_datasource text := rm_version_suffix(datasource);
|
|
731 | 731 |
BEGIN |
732 |
PERFORM set_config('search_path', util.schema_ident($2), true);
|
|
732 |
PERFORM set_config('search_path', util.schema_ident(schema_null), true);
|
|
733 | 733 |
|
734 | 734 |
-- don't datasource_rm() the datasource to publish! |
735 | 735 |
IF live_datasource = datasource THEN RETURN; END IF; |
736 | 736 |
|
737 | 737 |
BEGIN -- nested transaction |
738 |
PERFORM datasource_rm(live_datasource, $2);
|
|
739 |
PERFORM datasource_rename($1, live_datasource, $2);
|
|
738 |
PERFORM datasource_rm(live_datasource, schema_null);
|
|
739 |
PERFORM datasource_rename(datasource, live_datasource, schema_null);
|
|
740 | 740 |
EXCEPTION |
741 | 741 |
WHEN SQLSTATE /*successful_completion*/'00000' THEN NULL; -- need at least one WHEN clause |
742 | 742 |
END; |
743 | 743 |
END; |
744 |
$_$;
|
|
744 |
$$; |
|
745 | 745 |
|
746 | 746 |
|
747 | 747 |
-- |
Also available in: Unified diff
schemas/vegbien.sql: datasource_publish(): use parameter names instead of $# because this is a PL/pgSQL function