Forum OpenACS Q&A: Re: Rudimentary development method questions

Collapse
Posted by Tom Jackson on
  • You have to specify all the parameters to a plpgsql function call. The name of the function, plus the number and type of the parameters are used to determine which function body to use, since you can overload functions.
  • Plpgsql doesn't support default values like Oracle pl/sql does.
  • I think the attributes you are directed to 'ignore' are the use of acs_attributes. I don't know for sure, but you obviously can't ignore actual table or function attributes.
  • Collapse
    Posted by Tilmann Singer on
    Plpgsql doesn't support default values like Oracle pl/sql does.

    Just a clarification: when porting from oracle to postgresql the default values have been preserved as inline comments, so that the caller knows which values to set if the defaults are desired, kludging around the fact that plpgsql doesn't support default values like plsql. In plpgsql you would have to call the proc above somehow like this:

    select note__new(
      null,
      null,
      :title,
      :body,
      'note',
      now(),
      null,
      null,
      null
    )
    
    when you only want to specify the two required arguments, title and body.

    If that's a common way to call that procedure then the package author could provide an overloaded variant of the procedure that only takes these two arguments for convenience, like:

    note__new(varchar, varchar)