Re: sequences and pg_type

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pw <p(dot)willis(at)telus(dot)net>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: sequences and pg_type
Date: 2003-09-07 01:19:27
Message-ID: 1585.1062897567@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

pw <p(dot)willis(at)telus(dot)net> writes:
> I have a table with a serial type in it as a record id.
> The type of this object comes back as int4 when I query via
> pg_type.
> How can I distinguish this counter type from just a plain int4?

Well, you can't, because serial isn't actually a type in Postgres.
As the manual tries to explain, serial is just a shorthand for creating
an integer column whose default is a nextval() call on a sequence.
So the way to tell is to look for a default expression of that kind.

regards, tom lane

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message pw 2003-09-07 03:38:37 Re: sequences and pg_type
Previous Message Tom Lane 2003-09-07 01:13:27 Re: Needed function IF(expr, expr, expr)