Skip site navigation (1) Skip section navigation (2)

Re: determine sequence name for a serial

From: Jonathan Daugherty <cygnus(at)cprogrammer(dot)org>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: determine sequence name for a serial
Date: 2004-10-28 23:25:10
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-general
# But I didn't understand why you care to get rid of the explicit reference to 
# the sequence object in your code in the first place.  In PostgreSQL, at 
# least for the past 5 years if not longer, if you create a SERIAL column for 
# (schemaname, tablename, columnname), then your sequence will *always* be 
# "schemaname.tablename_columnname_seq".  If that naming convention changes, 
# there will be a whole lotta breakage world-wide.

When a table is renamed, related sequences' names don't change (as of
7.4.5).  The ability to automagically pull the sequence based on the
schema.table.column would be nice if you don't want to worry about
having to update your table name and sequence name references in code.

  Jonathan Daugherty
  Command Prompt, Inc. -
  PostgreSQL Replication & Support Services, (503) 667-4564

In response to

pgsql-general by date

Next:From: Michael FuhrDate: 2004-10-28 23:31:35
Subject: Re: determine sequence name for a serial
Previous:From: Michael FuhrDate: 2004-10-28 23:21:52
Subject: Re: Turning a subselect into an array

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group