If someone use a sequence name containing an upper case letter, he will be able to run its app once and query the sequence successfully but it will fail on the next app launch.
Code to create the sequence does not add double quotes, so the identifier is converted to lower case.
When you query the nextval, the identifier is also not double-quoted so its lower case version is used and the sequence returns the desired value.
Next time you run your app, the code that looks if the sequence exists or not uses the identifier as-is, so containing an upper-case. There is no sequence under that name so the sequence is created again, using again the lower-cased name, which already exists.
Solutions:
1) always double quote the sequence name
2) or lower-case the sequence name when looking if it already exists
If someone use a sequence name containing an upper case letter, he will be able to run its app once and query the sequence successfully but it will fail on the next app launch.
Code to create the sequence does not add double quotes, so the identifier is converted to lower case. When you query the nextval, the identifier is also not double-quoted so its lower case version is used and the sequence returns the desired value.
Next time you run your app, the code that looks if the sequence exists or not uses the identifier as-is, so containing an upper-case. There is no sequence under that name so the sequence is created again, using again the lower-cased name, which already exists.
Solutions: 1) always double quote the sequence name 2) or lower-case the sequence name when looking if it already exists
PS: as reported in this stackoverflow post