[sf-perl] Last Insert ID

Josh Berkus josh at agliodbs.com
Fri Apr 1 10:20:50 PST 2005


Shane,

> yup, that was one of the ways I contemplated doing this. But you are
> hosed if  Pg starts auto naming things differently. 

That's not too likely at this point.  In older versions, it could hose you 
because we had a 32-character identifier limit, so sometimes sequence names 
would get truncated.

The other alternative is to manually name your sequences.   That declaration 
looks like:

CREATE SEQUENCE users_seq;
...
	user_id INT NOT NULL PRIMARY KEY DEFAULT nextval('users_seq'),

... instead of ...

	user_id SERIAL PRIMARY KEY

And is it just me, or did the other SFPUG just sort of annex the SFPerl 
list?   ;-)

-- 
--Josh

Josh Berkus
Aglio Database Solutions
San Francisco


More information about the SanFrancisco-pm mailing list