Sequence name changed without database modification
Description
relates to
Activity

Matthew Jones January 14, 2015 at 4:31 PM
Yeah, that's right, if you skipped 10.0 and 10.1 this wouldn't even effect you at all and there's nothing to run or do.
The bottom line is that you only want SAM_PUBLISHEDATTACHMENT_ID_S. If you have SAM_PUBATTACHMENT_ID_S you either need to remove it or rename it (if you don't have SAM_PUBLISHEDATTACHMENT_ID_S. But odds are you won't see that column.
I think the only group of people who would really find this a problem are those that started for the first time with a fresh Sakai (no upgrades) on Oracle with versions 10.0 or 10.1. After 10.2 it won't matter anymore. Otherwise the worst case is that you'd have a useless sequence.

Paul Lukasewych January 14, 2015 at 4:24 PM
I just ran into this and find the whole thing very unclear. I'm upgrading from 2.9.1 to 10.3 by running the conversion scripts for 2.9.1 -> 2.9.2 -> 2.9.3 -> 10.0 -> 10.1 -> 10.2 -> 10.3. I got an error trying to run this PL/SQL, and after reading this ticket I still am not sure if it was intentional or not given my upgrade path.
It would be better if the comment said something explicit like "You may encounter errors running this script, if so see SAM-2408", and this ticket could do a better job spelling out what you want the end result to be.
As I understand it:
You will have one or both of these sequences:
SAM_PUBLISHEDATTACHMENT_ID_S;
SAM_PUBATTACHMENT_ID_S;
If you have both, drop PUBATTACHMENT.
If you have only PUBATTACHMENT, rename it to PUBLISHEDATTACHMENT.
In the end, you want to only have PUBLISHEDATTACHMENT.

Hudson CI Server September 27, 2014 at 9:14 PM
UNSTABLE: Integrated in sakai-10-java-1.7 #128 (See http://builds.sakaiproject.org:8080/job/sakai-10-java-1.7/128/)
- Sequence named changed without database modification (matthew@longsight.com: rev 313938)
merge 313932 from trunk (enietzel@anisakai.com: rev 313934)

Hudson CI Server September 27, 2014 at 2:06 AM
UNSTABLE: Integrated in sakai-trunk-java-1.7 #445 (See http://builds.sakaiproject.org:8080/job/sakai-trunk-java-1.7/445/)
oracle conversion script (enietzel@anisakai.com: rev 313932)

Juanjo Meroño September 26, 2014 at 2:07 AM
What about this?
– Restoring sequence if missing
declare
init_value number;
bad_object number;
begin
select object_type into bad_object from user_objects where object_name = 'SAM_PUBATTACHMENT_ID_S';
if bad_object = 'SEQUENCE' then
select SAM_PUBATTACHMENT_ID_S.nextval into init_value from dual;
execute immediate 'create sequence SAM_PUBLISHEDATTACHMENT_ID_S start with ' || init_value;
end if;
execute immediate 'drop ' || bad_object || ' SAM_PUBATTACHMENT_ID_S';
exception when no_data_found then
null; – Nothing to do
end;
– end
1) Upgrade from Sakai < 10 to Sakai 10.2+
The script won't do anything (but won't fail).
2) Upgrade from Sakai 10.0 or 10.1 to Sakai 10.2+
The script removes the wrong sequence (or synonym) and creates the right one (if needed) starting at the same point it was the wrong one.
3) Upgrade from Sakai < 10 to Sakai 10.0 or 10.1
You'll have the error and it supposed you will find this jira.
Please upgrade to 10.2 or create a synonym, the 10.2 script will remove later.
– create synonym SAM_PUBATTACHMENT_ID_S for SAM_PUBLISHEDATTACHMENT_ID_S;
This error is launched after migration to Sakai 10:
org.sakaiproject.tool.assessment.services.assessment.PublishedAssessmentService - org.springframework.dao.InvalidDataAccessResourceUsageException: could not get next sequence value; SQL [select SAM_PUBATTACHMENT_ID_S.nextval from dual];
This is due to the change at revision 305964.
https://source.sakaiproject.org/websvn/comp.php?repname=sakai-svn&compare[0]=%2Fsam%2Ftrunk%2Fsamigo-hibernate%2Fsrc%2Fjava%2Forg%2Fsakaiproject%2Ftool%2Fassessment%2Fdata%2Fdao%2Fassessment%2FPublishedItemData.hbm.xml&compare[1]=%2Fsam%2Ftrunk%2Fsamigo-hibernate%2Fsrc%2Fjava%2Forg%2Fsakaiproject%2Ftool%2Fassessment%2Fdata%2Fdao%2Fassessment%2FPublishedItemData.hbm.xml&compare_rev[0]=305964&compare_rev[1]=305963
That changes the name of the sequence from SAM_PUBLISHEDATTACHMENT_ID_S to SAM_PUBATTACHMENT_ID_S.
I think this is a mistake due to merge or something like that but totally unintentional. If this change is on purpose then some code is needed in migration script to change sequence name.