On Tuesday 09 September 2003 08:10, "expect" wrote:
> Hello,
>
> Trying to get this MySql create table command to work, no luck.
>
> create sequence serial;
>
> CREATE TABLE outbound (
> source char(100) default '',
> destination char(100) default '',
> sport int4 default 0 NOT NULL,
> dport int4 NOT NULL default 0,
> time timestamp NOT NULL default '0000-00-00 00:00:00',
> id int8 default nextval('serial') not null,
> constraint id PRIMARY (id)
> );
usually you would change the last two lines to:
...
id SERIAL,
PRIMARY KEY (id)
...
You don't need to create a sequence in most cases,
although I'm guessing you want to use int8 if you're storing firewall logs:
create sequence outbound_id_seq;
and primary key definition as:
...
id int8 default nextval('serial') not null,
PRIMARY KEY (id)
...
You will need to do something about the timestamp
default of zero, this is a MySQL-ism and won't work in PostgreSQL.
Probably dropping the NOT NULL constraint and DEFAULT altogether would
be best; if the timestamp should default to the current time,
use DEFAULT NOW().
Ian Barwick
barwick@gmx.net