From: | John Hansen <john(at)geeknet(dot)com(dot)au> |
---|---|
To: | pgsql-patches(at)postgresql(dot)org |
Subject: | calling currval() before nextval() patch adding currval_isset() |
Date: | 2004-11-07 22:21:50 |
Message-ID: | 1099866110.16869.14.camel@localhost.localdomain |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-patches |
Hi list,
attached, cvs context diff that adds currval_isset('sequence_name');
This avoids the warning messages you get when calling currval before
nextval in situations where the program flow does not allow you to
predetermine if the current session has called nexval yet.
I have for example, a general db_insert function, that needs to return
the currval value, or 0 if the table that was inserted on doesn't have a
sequence (sortof emulating mysql's last_insert_id function).
With this patch, I can now call currval_isset to determine if I need to
call currval. Previously, I just called currval, but with the result of
filling up the server log with warnings.
Kind Regards,
John Hansen
PS I picked OID 1295 for this function, as it's currently available
according to unused_oids.
Attachment | Content-Type | Size |
---|---|---|
currval_isset.diff | text/x-patch | 3.2 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Andrew Dunstan | 2004-11-07 22:50:07 | win32 cleanup |
Previous Message | Tom Lane | 2004-11-07 20:48:56 | Re: pg_resetxlog options |