Project

General

Profile

« Previous | Next » 

Revision 10858

bugfix: schemas/vegbien.sql: datasource_publish(): run it in a nested transaction so that there is always one published copy of the datasource. (note that a nested transaction is not automatically created for each function, http://stackoverflow.com/questions/6274457/set-isolation-level-for-postgresql-stored-procedures?In_PG_your_procedures_aren%27t_separate_transactions#answer-6283201 .)

View differences:

vegbien.sql
724 724
--
725 725

  
726 726
CREATE FUNCTION datasource_publish(datasource text, schema_null anyelement DEFAULT NULL::source) RETURNS void
727
    LANGUAGE sql
727
    LANGUAGE plpgsql
728 728
    AS $_$
729
SELECT set_config('search_path', util.schema_ident($2), true);
730
SELECT datasource_rm($1, $2);
731
SELECT datasource_rename($1, rm_version_suffix($1), $2);
729
BEGIN
730
	PERFORM set_config('search_path', util.schema_ident($2), true);
731
	BEGIN -- nested transaction
732
		PERFORM datasource_rm($1, $2);
733
		PERFORM datasource_rename($1, rm_version_suffix($1), $2);
734
	EXCEPTION
735
		WHEN SQLSTATE /*successful_completion*/'00000' THEN NULL; -- need at least one WHEN clause
736
	END;
737
END;
732 738
$_$;
733 739

  
734 740

  
......
5542 5548
-- Data for Name: source; Type: TABLE DATA; Schema: public; Owner: -
5543 5549
--
5544 5550

  
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);
5545 5552

  
5546 5553

  
5547 5554
--

Also available in: Unified diff