Index: openacs-4/packages/download/download.info =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/download/download.info,v diff -u -r1.17 -r1.18 --- openacs-4/packages/download/download.info 3 Sep 2015 19:41:39 -0000 1.17 +++ openacs-4/packages/download/download.info 30 Apr 2016 09:40:15 -0000 1.18 @@ -7,7 +7,7 @@ f f - + oracle postgresql @@ -19,7 +19,7 @@ OpenACS Intended to support downloads of versioned software and packages. UI needs work. - + Index: openacs-4/packages/download/sql/postgresql/download-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/download/sql/postgresql/download-create.sql,v diff -u -r1.10 -r1.11 --- openacs-4/packages/download/sql/postgresql/download-create.sql 25 Jul 2015 17:58:28 -0000 1.10 +++ openacs-4/packages/download/sql/postgresql/download-create.sql 30 Apr 2016 09:40:15 -0000 1.11 @@ -52,9 +52,6 @@ -- Each download module will support certain archive types, we need to indicate -- what those types are. -create sequence download_archive_type_seq; -create view download_archive_type_sequence as - select nextval('download_archive_type_seq') as nextval; create table download_archive_types ( archive_type_id integer constraint download_archive_types_pk @@ -70,9 +67,7 @@ This table stores the types of archives that can be stored in a given download repository. '; -create sequence download_reasons_seq; -create view download_reasons_sequence as - select nextval('download_reasons_seq') as nextval; +create sequence download_reasons_sequence; create table download_reasons ( download_reason_id integer constraint download_archive_reasons_pk Index: openacs-4/packages/download/sql/postgresql/download-drop.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/download/sql/postgresql/download-drop.sql,v diff -u -r1.8 -r1.9 --- openacs-4/packages/download/sql/postgresql/download-drop.sql 17 May 2003 10:28:58 -0000 1.8 +++ openacs-4/packages/download/sql/postgresql/download-drop.sql 30 Apr 2016 09:40:15 -0000 1.9 @@ -20,10 +20,8 @@ drop view download_downloads_repository; -- Sequences -- -drop sequence download_archive_type_seq; -drop view download_archive_type_sequence; -drop sequence download_reasons_seq; -drop view download_reasons_sequence; + +drop sequence download_reasons_sequence; drop sequence download_md_choice_id_seq; drop view download_md_choice_id_sequence; drop sequence download_downloads_seq; Index: openacs-4/packages/download/sql/postgresql/upgrade/upgrade-5.2d6-5.2d7.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/download/sql/postgresql/upgrade/upgrade-5.2d6-5.2d7.sql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/download/sql/postgresql/upgrade/upgrade-5.2d6-5.2d7.sql 30 Apr 2016 09:40:15 -0000 1.1 @@ -0,0 +1,32 @@ +create or replace function inline_0 () +returns integer as $$ +DECLARE + v_dummy integer; +BEGIN + select setting from pg_settings where name='server_version_num' and setting::int >= 90200 into v_dummy; + IF found THEN + + drop view IF EXISTS download_reasons_sequence; + ALTER SEQUENCE IF EXISTS download_reasons_seq RENAME TO download_reasons_sequence; + + -- remove unused sequence + drop view IF EXISTS download_archive_type_seqence; + DROP SEQUENCE IF EXISTS download_archive_type_seq; + + ELSE + -- version earlier than 9.2, no "IF EXISTS" on ALTER SEQUENCE + drop view download_reasons_sequence; + ALTER SEQUENCE download_reasons_seq RENAME TO download_reasons_sequence; + + -- remove unused sequence + drop view download_archive_type_seqence; + DROP SEQUENCE download_archive_type_seq; + + END IF; + return 1; +END; +$$ language 'plpgsql'; + +select inline_0(); +drop function inline_0(); +