Re: identity columns ?

From: "Joshua b(dot) Jore" <josh(at)greentechnologist(dot)org>
To:
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: identity columns ?
Date: 2002-04-05 17:04:38
Message-ID: Pine.BSO.4.40.0204051100460.2976-100000@kitten.greentechnologist.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

So this raises a question I was wondering, what use *is* the oid column in
non-system tables? The only thing I could think of is for last-resort row
uniqueness if the application somehow borked up. Are there any other
reasons to even have this column in a user table?

Joshua b. Jore
http://www.greentechnologist.org

On Fri, 5 Apr 2002, Josh Berkus wrote:

> Harald, Chris,
>
> > > 1. M$ SQL Server has an identity column which generates a
> > sequential number
> > > for you, we use this often for unique primary keys. Does postgres
> > support
> > > anything like this ?
> >
> > select *,oid from your_table
>
> NO!!!! This is wrong. DO NOT USE the oid for anything other than
> system purposes. It is NOT a user-friendly value for several reasons.
>
> Chris, the data type you want is SERIAL. Please read the section of
> the docs on sequences:
> http://www.postgresql.org/idocs/index.php?sql-createsequence.html
> ... as the SERIAL datatype simply automates the creation of a sequence.
> BTW, postgres sequences are both more powerful and more user-friendly
> than MS SQL Identity columns.
>
> I would also strongly suggest buying a beginner's postgresql book, such
> as "PostgreSQL: Introduction and Concepts" or Wrox Press' PostgreSQL
> book.
>
> -Josh Berkus
>
> ---------------------------(end of broadcast)---------------------------
> TIP 6: Have you searched our list archives?
>
> http://archives.postgresql.org
>
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (OpenBSD)
Comment: For info see http://www.gnupg.org

iD8DBQE8rdkofexLsowstzcRAsDcAKDfShTlMHsD/atFKi0XcgQOODk+TQCg7Ka0
TO9O4+J007jd8v9W0oOlhYs=
=8hjf
-----END PGP SIGNATURE-----

In response to

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Lloyd Vancil 2002-04-05 17:17:40 Re: OID
Previous Message Josh Berkus 2002-04-05 16:21:53 Re: identity columns ?