From: | Ian Barwick <barwick(at)gmx(dot)net> |
---|---|
To: | expect <expect(at)ihubbell(dot)com>, pgsql-general(at)postgresql(dot)org |
Subject: | Re: mysql create table -> psql |
Date: | 2003-09-09 06:53:50 |
Message-ID: | 200309090853.50651.barwick@gmx.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
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(at)gmx(dot)net
From | Date | Subject | |
---|---|---|---|
Next Message | mailrun | 2003-09-09 09:10:20 | |
Previous Message | Tom Lane | 2003-09-09 06:23:09 | Re: Views and Limits |