From: | Brian Modra <epailty(at)googlemail(dot)com> |
---|---|
To: | Thomas Løcke <thomas(dot)granvej6(at)gmail(dot)com> |
Cc: | pgsql-novice(at)postgresql(dot)org |
Subject: | Re: My first PL/pgSQL function |
Date: | 2009-11-17 15:39:17 |
Message-ID: | 5a9699850911170739q60cbefc5q5a5503f1ed200c0@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-novice |
2009/11/17 Thomas Løcke <thomas(dot)granvej6(at)gmail(dot)com>:
> Hey all,
>
> First I'd like to thank Jasen Betts and Michael Wood for the advice they
> gave me regarding my user management table design.
>
> Next I'd like some feedback on my first PL/pgSQL function:
> http://pastebin.com/f8357ec0
>
> It appears to be doing exactly what I want, and it's fast at doing it.
> Compared to my old "SQL in PHP" solution, this is ~25% faster. And it looks
> a lot more smooth in the code also.
>
> So in my book, this is all win.
>
> But are there any glaring issues with this function? Have I missed something
> obvious, or made some classic beginner mistakes?
You need to use nextval() ratehr than curval(), otherwise the sequence
will not get incremented.
> Any and all advice are more than welcome, and much appreciated.
>
> Regards,
> Thomas
>
--
Brian Modra Land line: +27 23 5411 462
Mobile: +27 79 69 77 082
5 Jan Louw Str, Prince Albert, 6930
Postal: P.O. Box 2, Prince Albert 6930
South Africa
http://www.zwartberg.com/
From | Date | Subject | |
---|---|---|---|
Next Message | Richard Broersma | 2009-11-17 16:44:25 | Re: 8.38 -> 8.5? |
Previous Message | Thomas Løcke | 2009-11-17 14:55:06 | My first PL/pgSQL function |