Re: sequence aliases?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: CSN <cool_screen_name90001(at)yahoo(dot)com>
Cc: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: sequence aliases?
Date: 2005-11-06 03:35:06
Message-ID: 22016.1131248106@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

CSN <cool_screen_name90001(at)yahoo(dot)com> writes:
> I'm checking out Ruby on Rails and there's a tutorial
> about using Postgresql views and making them
> updateable
> (http://wiki.rubyonrails.com/rails/pages/HowtoUsePostgresViewsAsTables).
> The tutorial suggests renaming the sequence for the
> table to coincide with the view so that Rails can
> automatically access the sequence. I don't like this
> as it may break other things.

Not to mention that it won't actually work --- the proposed approach
fails because PG will refuse to let you drop the original sequence.
(It has failed in every release since 7.3, so I don't put a lot of stock
in that tutorial having been tested much.) Furthermore, it's quite
likely that future releases won't let you fool with the default
expression of a serial column at all.

My advice to the Rails people would be to fix whatever it is in their
code that is assuming a particular sequence name, or indeed assuming
a sequence at all...

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Greg Stark 2005-11-06 05:15:45 Re: sequence aliases?
Previous Message Tom Lane 2005-11-06 03:22:30 Re: Setting max_fsm_pages