On 3 April 2014 16:41, Ben Hoyt <benhoyt@xxxxxxxxx> wrote: > Hi folks, > I tried using currval() to see if that'd work, but it gave an error, I guess > because I was using it multiple times per session. currval() requires that nextval() was called before it (either automatically or explicitly) in the same transaction. Usually what you want is achieved using nextval(). You request n new ID's using nextval(), which you can then use to both name your n image files and for the ID with which you will be inserting them into your table. Unfortunately there doesn't appear to be a variant of nextval() that you pass a number which then subsequently returns a set of values, that would be ideal for such usage, but that can be worked around by calling nextval() in conjunction with generate_series(). -- If you can't see the forest for the trees, Cut the trees and you'll see there is no forest. -- Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general