[OPEN-ILS-DEV] AUTO-GENERATED

Mike Rylander mrylander at gmail.com
Wed May 27 11:26:16 EDT 2009


Ooops ... I left out the last bit.  See below.

On Wed, May 27, 2009 at 9:13 AM, Mike Rylander <mrylander at gmail.com> wrote:
> On Wed, May 27, 2009 at 9:01 AM, Grant Johnson <fgjohnson at upei.ca> wrote:
>> Thanks Bill,
>> How might I change that to UPEI or something?
>
> You could issue:

CREATE OR REPLACE FUNCTION biblio.next_autogen_tcn_value ()
  RETURNS TEXT AS $$
    BEGIN
      RETURN 'UPEI-' || nextval('biblio.autogen_tcn_value_seq'::TEXT);
    END;
  $$ LANGUAGE PLPGSQL;

--miker

> in psql.
>
> That stored procedure is used when there is no non-colliding TCN
> candidate in the record, and (hopefully!) no cadidate TCNs are in the
> form of "AUTOGENERATED-{number}".  Have you found a case where they
> are, and you can't spot your own autogenerated tcns?  As long as the
> prefix is stable, and no one else is using it, any value is equivalent
> -- UPEI and AUTOGENERATED serve the same purpose.  I'm just concerned
> about db-level (essentially) aesthetic changes that could potentially
> cause upgrade pain.
>
> --miker
>
>>
>>>>> On Wed, May 27, 2009 at  9:47 AM, in message <4A1D366A.6080606 at grpl.org>, Bill
>> Ott <bott at grpl.org> wrote:
>>> Grant Johnson said the following on 05/27/2009 08:42 AM:
>>>> Where might I find the "AUTO-GENERATED" string for auto-generated TCN's during
>>> Z39-50 import.
>>>> Can't find it with a grep...
>>>>
>>>> Is it in the database?
>>>>
>>>>
>>>
>>> Indeed it is, assuming you're looking for the following.
>>>
>>> Found in:
>>>  Open-ILS/src/sql/Pg/1.2.2.3-1.2.3.0-upgrade.sql
>>>
>>>
>>> CREATE OR REPLACE FUNCTION biblio.next_autogen_tcn_value () RETURNS TEXT
>>> AS $$
>>>     BEGIN RETURN 'AUTOGENERATED-' ||
>>> nextval('biblio.autogen_tcn_value_seq'::TEXT); END;
>>
>>
>>
>
>
>
> --
> Mike Rylander
>  | VP, Research and Design
>  | Equinox Software, Inc. / The Evergreen Experts
>  | phone:  1-877-OPEN-ILS (673-6457)
>  | email:  miker at esilibrary.com
>  | web:  http://www.esilibrary.com
>



-- 
Mike Rylander
 | VP, Research and Design
 | Equinox Software, Inc. / The Evergreen Experts
 | phone:  1-877-OPEN-ILS (673-6457)
 | email:  miker at esilibrary.com
 | web:  http://www.esilibrary.com


More information about the Open-ils-dev mailing list