Contact - Twitter Icon Twitter - RSS Feed Icon RSS

TomNomNom.com

The web stuff of Tom Hudson.

Bio

Friends

Files

Tweets

An easier way to get PostgreSQL sequence names Thu Jan 8 22:11:01 2009

I got owned. OK, not owned exactly... But reminded of my nooby-ness. Reddit user Thristian99 gave me a much simpler solution to finding out the name of a sequence...


select pg_get_serial_sequence('tablename', 'fieldname');


That's a whole lot nicer :-) I did think it nice to know how the names are actually handled, though - and it only works if the tables / sequences have already been created, of course.

Back to the main page