Re: [GENERAL] Row ID and auto-increment?

2001-02-20 Thread Brent R. Matzelle

You can create an auto incrementing field with SERIAL.  Take a
look at the FAQ
(http://www.postgresql.org/docs/faq-english.html#4.16.1).  

Brent

--- Raymond Chui [EMAIL PROTECTED] wrote:
 If I create a table like
 
 create table tablename (
 aNuminteger not null,
 namevarchar(10)
 );
 
 If I do select * from tablename;
 
 q1. Is there such thing rowid similar to Oracle in PostgreSQL?
 q2. How do I make aNum auto increment by 1? Need to write
 a trigger? how to write that?
 I want to enforce column aNum 0,1,2,.n.
 I want to prevent data entry people input 0,1,4,5,8,...n.
 Thank you very much in advance!
 
 
 
 
 --Raymond
 
  begin:vcard 
 n:Chui;Raymond
 tel;fax:(301)713-0963
 tel;work:(301)713-0624 Ext. 168
 x-mozilla-html:TRUE
 url:http://members.xoom.com/rchui/
 org:NWS, NOAA
 version:2.1
 email;internet:[EMAIL PROTECTED]
 title:SA, DBA
 note:ICQ #: 16722494
 adr;quoted-printable:;;NOAA, NWS, Office of Hydrology,
 OH=0D=0A1325 East-West Highway, Room 8112;Silver
 Spring;MD;20910-3283;U.S.A.
 x-mozilla-cpt:;-6384
 fn:Raymond Chui
 end:vcard
 


__
Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail - only $35 
a year!  http://personal.mail.yahoo.com/



[GENERAL] Row ID and auto-increment?

2001-02-16 Thread Raymond Chui

If I create a table like

create table tablename (
aNuminteger not null,
namevarchar(10)
);

If I do select * from tablename;

q1. Is there such thing rowid similar to Oracle in PostgreSQL?
q2. How do I make aNum auto increment by 1? Need to write
a trigger? how to write that?
I want to enforce column aNum 0,1,2,.n.
I want to prevent data entry people input 0,1,4,5,8,...n.
Thank you very much in advance!




--Raymond



begin:vcard 
n:Chui;Raymond
tel;fax:(301)713-0963
tel;work:(301)713-0624 Ext. 168
x-mozilla-html:TRUE
url:http://members.xoom.com/rchui/
org:NWS, NOAA
version:2.1
email;internet:[EMAIL PROTECTED]
title:SA, DBA
note:ICQ #: 16722494
adr;quoted-printable:;;NOAA, NWS, Office of Hydrology, OH=0D=0A1325 East-West Highway, Room 8112;Silver Spring;MD;20910-3283;U.S.A.
x-mozilla-cpt:;-6384
fn:Raymond Chui
end:vcard