Project

General

Profile

« Previous | Next » 

Revision 10859

bugfix: schemas/vegbien.sql: datasource_publish(): need to remove the current live datasource instead of the datasource to publish. note that datasource_rename() does not currently generate an error if the specified datasource doesn't exist.

View differences:

schemas/vegbien.my.sql
4275 4275
-- Data for Name: source; Type: TABLE DATA; Schema: public; Owner: -
4276 4276
--
4277 4277

  
4278
INSERT INTO source VALUES (6, NULL, NULL, 'a', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '2013-09-04', NULL, '2013-09-04', NULL, NULL);
4278
INSERT INTO source VALUES (7, NULL, NULL, 'a', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '2013-09-04', NULL, '2013-09-04', NULL, NULL);
4279 4279

  
4280 4280

  
4281 4281
--
schemas/vegbien.sql
726 726
CREATE FUNCTION datasource_publish(datasource text, schema_null anyelement DEFAULT NULL::source) RETURNS void
727 727
    LANGUAGE plpgsql
728 728
    AS $_$
729
DECLARE
730
	live_datasource text := rm_version_suffix($1);
729 731
BEGIN
730 732
	PERFORM set_config('search_path', util.schema_ident($2), true);
731 733
	BEGIN -- nested transaction
732
		PERFORM datasource_rm($1, $2);
733
		PERFORM datasource_rename($1, rm_version_suffix($1), $2);
734
		PERFORM datasource_rm(live_datasource, $2);
735
		PERFORM datasource_rename($1, live_datasource, $2);
734 736
	EXCEPTION
735 737
		WHEN SQLSTATE /*successful_completion*/'00000' THEN NULL; -- need at least one WHEN clause
736 738
	END;
......
5548 5550
-- Data for Name: source; Type: TABLE DATA; Schema: public; Owner: -
5549 5551
--
5550 5552

  
5551
INSERT INTO source VALUES (6, NULL, NULL, 'a', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '2013-09-04', NULL, '2013-09-04', NULL, NULL);
5553
INSERT INTO source VALUES (7, NULL, NULL, 'a', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '2013-09-04', NULL, '2013-09-04', NULL, NULL);
5552 5554

  
5553 5555

  
5554 5556
--

Also available in: Unified diff