Re: auto_increment

From: Date: Sat, 27 Apr 2002 15:49:55 +0000
Subject: Re: auto_increment
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-94902@lists.php.net to get a copy of this message
MySQL: create table foo ( id int not null auto_increment primary key, state enum('enabled', 'disabled') ); PostgreSQL: create table foo ( id int not null primary key default nextval('foo_id_seq'), state varchar(8) check (state in ('enabled', 'disabled')) ); create sequence foo_id_seq; select setval('foo_id_seq', (select max(id) from foo)); More: http://www.ca.postgresql.org/docs/faq-english.html#4.15.1 -- Kind regards,Yuri. >>>> www.AceHoster.com <<<< Quality web hosting "Webmaster" <webmaster@harbornet.com> > I'm using PHP v.4.0.6. and PostgreSQL 7.2. Does any one know the > equivilant of auto_increment for postgresSQL? For example when creating > a table: > > $query = "CREATE table $tablename (id INT UNSIGNED NOT NULL > AUTO_INCREMENT PRIMARY KEY, firstname TEXT, lastname TEXT, emailaddress > TEXT, )"; > > this works fine in MySQL, but I keep getting errors with PostgreSQL. > > thanks for any help, > -Elkan >

« previous php.general (#94902) next »