Forum OpenACS Development: sequence view not working...
create sequence sp_session_id_seq;
create view sp_session_id_sequence as select nextval('sp_session_id_seq') as nextval;
What am I doing wrong?
openacs4=# create sequence sp_session_id_seq; CREATE openacs4=# create view sp_session_id_sequence as select nextval('sp_session_id_seq') as nextval; CREATE openacs4=# select sp_session_id_sequence.nextval; nextval --------- 1 (1 row) openacs4=# select sp_session_id_sequence.nextval; nextval --------- 2 (1 row) openacs4=#
It looks like your problem is your version of PostgreSQL. It works fine for me too.
I was doing this
It is not clear that you need to change the db_nextval code to refer to the next sequence name.
Since this is called from a TCL page and is not pulled into a query file, should be change the Oracle data-model to use the same sequence name? That is sp_session_id_sequence instead of sp_session_id_seq.
Yup. The name that you choose for the oracle sequence should be the same as the postgres view
That makes sense to me, but is this being done? And is this what we should do (rename Oracle sequences to match the names of the views in PG)? Don? Dan?
is that some will go over the 30 character limit in oracle.
ACS_ATTRIBUTE_VALUE_ID_SEQ and AD_TEMPLATE_SAMPLE_USERS_SEQ
both would be too long.
untouched and to make the postgres view match the oracle sequence. Of
course, this isn't always consistent because in some packages the
oracle sequence is _seq and in some it's _sequence.
So, if we want consistency across packages, we should probably use
_seq (for length considerations)
As everyone knows, I'm a bear for consistency and due to length considerations, _seq is preferable to _sequence in Oracle names. But, I'm not so anal about consistency that I'll ask all porters to weed out names in existing Oracle datamodel code inherited from aD. If you want to, sure, do so, though!