Search Postgresql Archives

Re: Better alternative for Primary Key then serial??

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



pilzner wrote:
> 
> 
> 
> Alvaro Herrera-3 wrote:
> > 
> > Just do not update the ID -- what use do you have for that
> > anyway?  If you want to prevent it, you can put a trigger to the column,
> > but IMHO it would be a waste of your time and machine resources.
> > 
> 
> I have absolutely no use to update the ID. I'm not sure why anyone ever
> would, and I guess I was a little shocked to find that PostGres even allows
> it.

Oh, I see.  Fact is, Postgres defines it like a plain integer column and
attaches a DEFAULT clause.  That's it.  There's no magic to prevent it
from being modified.

The SQL standard specifies a strange beast called GENERATED BY which has
all sorts of funny behaviors, one of which is what you describe.  There
have been attempts at implementing the semantics described be the spec,
but they are so contorted that so far there hasn't been definitive
success.  It is expected that in the next release (8.4) something will
get done about it.

-- 
Alvaro Herrera                        http://www.advogato.org/person/alvherre
"How strange it is to find the words "Perl" and "saner" in such close
proximity, with no apparent sense of irony. I doubt that Larry himself
could have managed it."         (ncm, http://lwn.net/Articles/174769/)

---------------------------(end of broadcast)---------------------------
TIP 3: Have you checked our extensive FAQ?

               http://www.postgresql.org/docs/faq

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux