Re: mysql create table -> psql

Поиск
Список
Период
Сортировка
От Ian Barwick
Тема Re: mysql create table -> psql
Дата
Msg-id 200309090853.50651.barwick@gmx.net
обсуждение исходный текст
Ответ на mysql create table -> psql  (expect <expect@ihubbell.com>)
Список 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@gmx.net


В списке pgsql-general по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Views and Limits
Следующее
От: mailrun@mail333.com
Дата:
Сообщение: