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" <[EMAIL PROTECTED]>

> 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
>



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to