Forum OpenACS Q&A: Create File

Collapse
Posted by Sid Widge on
I get the following error: ERROR: ProcedureCreate: procedure wp_presentation__get_background already exists with same arguments This is my code see if you can help
create function wp_presentation__get_background_revision (
integer ) returns blob as'
declare
pres_revision_id	alias for $1;
v_blob			blob;  
  begin
    select cr_revisions__content into v_blob
    from cr_revisions ,   
         cr_wp_presentations_background 
    where cr_wp_presentations_background__presentation_id =
pres_revision_id
    and cr_revisions__revision_id =
cr_wp_presentations_background__id;
    return v_blob;
  end;' language 'plpgsql';
Collapse
2: Response to Create File (response to 1)
Posted by Jonathan Marsden on
Well,
  DROP FUNCTION wp_presentation__get_background_revision(integer);
is the obvious answer, but you presumably know that already 😊

If you are 100% sure that there is no such function already defined, I'd suggest that you check identifier length issues. That name is over 31 chars, so it would tend to conflict with anything named

  wp_presentation__get_background_WHATEVER 

for any value of WHATEVER. For example, do you have a function

  wp_presentation__get_background_id(integer) 

somewhere?

But usually, that sort of thing tends to generate warnings about long identifiers first, not just ERRORs. Did you see anything like

  NOTICE:  identifier "wp_presentation__get_background_WHATEVER"  will be 
    truncated to "wp_presentation__get_background" 

before the ERROR: message?

If that *is* the problem, then maybe using shorter identifiers, perhaps of the form

  wp_presentation__get_bg_WHATEVER 

would solve this?

Collapse
3: Response to Create File (response to 1)
Posted by Don Baccus on
You certainly would get the long name trunaction notice if that's the problem.  Unlike Oracle, Postgres doesn't have a "create or replace" function (or view) statement so you must delete old copies by hand (SQL92 doesn't have this, either).

Questions like this are probably better asked in the OpenACS 4 Design forum (which should really be named "design & implementation").

There's really no problem posting here but there may be folks so busy working on OpenACS 4 that they're only monitoring that forum, not the general forum, at least frequently.  Also this will help keep all our OpenACS 4 Q's and A's in one place.