Forum OpenACS Q&A: Sequence.nextval error

Collapse
Posted by David Lees on
Using OpenACS 3.2.2, PostgreSQL 7

I get errors when retrieval from sequences is defined ' select
sequence.nextval from dual ', but not when defined as ' select
nextval('sequence') '

OpenACS tcl scripts are laden with the former format. Is there a fix
to make PostgreSQL accept the former? Alternatively, is there a quick
way to re-format the scripts with the latter?

Thanks

Collapse
Posted by Dan Wickstrom on
select nextval('sequence') is the format that postgresql expects.  If you look more closely at the instances where we use sequence.nextval in tcl, the calling routines do a regsub on sequence.nextval and convert it to nextval('sequence') before passing it to the postgresql driver.  This is just a shortcut to save us from having to port all of those nexval statements.

You can fake the oracle syntax using a view:

create sequence sequence_name_t start 1;

create view sequence_name as
select nextval('sequence_name_t') as nextval;

Collapse
Posted by David Lees on
Dan,

Checked that all out, and I see what you're saying ... but something was still stuffing up.

Anyway, reinstalled ACS, since I'm still playing.  Everything's fine now!

Many thanks!

DaveL

Collapse
Posted by William Smith on
I am also getting that problem with Linux/Redhat 6.2 AOLServer
binarys.  This includes linking nsd with nsd7x and nsd8x.

Has anyone else seen or resolved this problem?