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)
);
I get a parse error:
ERROR: parser: parse error at or near "(" at character 279
---------------------------(end of broadcast)---------------------------
TIP 8: explain analyze is your friend 9 6738
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 ba*****@gmx.net
---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster
On Tuesday 09 September 2003 07: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) );
In addition to everything Ian says, you probably want varchar() not char() for
the source and destination. The char type is space-padded to the length of
the field (MySQL strips them somehow, but can't remember how off the top of
my head - anyway, varchar is the standard variable-length text type).
--
Richard Huxton
Archonet Ltd
---------------------------(end of broadcast)---------------------------
TIP 8: explain analyze is your friend
You might want to take a look at a Perl module, SQL::Translator, which
translates schema elements (table creates, indexes, views) from one DB's
SQL to another. I don't know if the S::T on CPAN is up to date, so you
might want to try their website to get the CVS version: http://sqlfairy.sourceforge.net/
Scott
On Tue, 2003-09-09 at 02: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) );
I get a parse error: ERROR: parser: parse error at or near "(" at character 279
---------------------------(end of broadcast)--------------------------- TIP 8: explain analyze is your friend
--
------------------------------------------------------------------------
Scott Cain, Ph. D. ca**@cshl.org
GMOD Coordinator ( http://www.gmod.org/) 216-392-3087
Cold Spring Harbor Laboratory
---------------------------(end of broadcast)---------------------------
TIP 7: don't forget to increase your free space map settings
On Tue, 9 Sep 2003, Richard Huxton wrote: On Tuesday 09 September 2003 07: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) );
In addition to everything Ian says, you probably want varchar() not char() for the source and destination. The char type is space-padded to the length of the field (MySQL strips them somehow, but can't remember how off the top of my head - anyway, varchar is the standard variable-length text type).
One more addition, you can use bigserial to define a serial with a big
int. Also, you might as well drop the explicit casting of int4, since int
= int4 right now, and in some future may be int8 when even calculator
watches are 64 bit. Might as well have your DDL ready to take advantage
of it.
Also, you can move your pk def into the single field defining the pkey
here (id).
also note, if you didn't have a pk defined on your serial and wanted it to
be ensured to be unique, you would need to add a unique keyword there as
well, since autounique indexes on serials went away around V7.3 of pgsql.
Finally, note that timestamp is a SQL spec type that does NOT do in
postgresql what it does in MySQL (i.e. get an auto inserted timestamp on
insert / update) so even the default now() isn't quite what you'd expect.
If you need that field to always get updated to the latest time when
the row is updated you'll have to write a trigger. It's a cardinal
example in the docs, I believe.
CREATE TABLE outbound (
source varchar(100) default '',
destination varchar(100) default '',
sport int default 0 NOT NULL,
dport int NOT NULL default 0,
time timestamp NOT NULL default now(),
id bigserial not null primary key
);
---------------------------(end of broadcast)---------------------------
TIP 7: don't forget to increase your free space map settings
the problem is
constraint id PRIMARY (id), it should be constraint id PRIMARY KEY (id).
Besides that, you will have problems with '0000-00-00'... month starts
at 1, day starts at 1, and I don't know about year 0. Maybe this field
'time' should be NULLable, or maybe its default value should be
'0001-01-01 00:00:00'.
On Tue, 2003-09-09 at 03: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) ); I get a parse error: ERROR: parser: parse error at or near "(" at character 279 ---------------------------(end of broadcast)--------------------------- TIP 8: explain analyze is your friend
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.2 (FreeBSD)
iD8DBQA/Xd5c21dVnhLsBV0RAsDEAJoDdObeF/s/a2F7JEh6PPNFAZUZbgCbBFeT
kV1KUSx31RTHSjqXLJkdkC8=
=WNDr
-----END PGP SIGNATURE-----
On Tue, 09 Sep 2003 09:36:08 -0400
Scott Cain <ca**@cshl.org> wrote: You might want to take a look at a Perl module, SQL::Translator, which translates schema elements (table creates, indexes, views) from one DB's SQL to another. I don't know if the S::T on CPAN is up to date, so you might want to try their website to get the CVS version:
http://sqlfairy.sourceforge.net/
Funny name, thanks. It's amazing how I didn't find this via google.com.
Is it just me or is google less effective than it once was? Sure seems like it.
I think they're going to have to modify their model. Scott
On Tue, 2003-09-09 at 02: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) );
I get a parse error: ERROR: parser: parse error at or near "(" at character 279
---------------------------(end of broadcast)--------------------------- TIP 8: explain analyze is your friend -- ------------------------------------------------------------------------ Scott Cain, Ph. D. ca**@cshl.org GMOD Coordinator (http://www.gmod.org/) 216-392-3087 Cold Spring Harbor Laboratory
---------------------------(end of broadcast)--------------------------- TIP 7: don't forget to increase your free space map settings
---------------------------(end of broadcast)---------------------------
TIP 7: don't forget to increase your free space map settings
expect wrote: On Tue, 09 Sep 2003 09:36:08 -0400 Scott Cain <ca**@cshl.org> wrote: You might want to take a look at a Perl module, SQL::Translator, which translates schema elements (table creates, indexes, views) from one DB's SQL to another. I don't know if the S::T on CPAN is up to date, so you might want to try their website to get the CVS version:
http://sqlfairy.sourceforge.net/
Funny name, thanks. It's amazing how I didn't find this via google.com. Is it just me or is google less effective than it once was? Sure seems like it. I think they're going to have to modify their model. Scott
On Tue, 2003-09-09 at 02: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) );
I get a parse error: ERROR: parser: parse error at or near "(" at character 279
---------------------------(end of broadcast)--------------------------- TIP 8: explain analyze is your friend
-- ------------------------------------------------------------------------ Scott Cain, Ph. D. ca**@cshl.org GMOD Coordinator (http://www.gmod.org/) 216-392-3087 Cold Spring Harbor Laboratory
---------------------------(end of broadcast)--------------------------- TIP 7: don't forget to increase your free space map settings
---------------------------(end of broadcast)--------------------------- TIP 7: don't forget to increase your free space map settings
I think google's reach into technical sites is diminishing. We generate
SOOOOOOOOOOOO much traffic on all the open source AND closed source
discussion groups, it's staggering.
Jeesh, it would be intereseting to know how many words, characters, etc
were in each of those domains. I be the folks at marc.theaimsgroup.com
could give us an idea about thiers plus add in sourceforge, and it'd be
a major part of it. Well, then there's the stuff on usenet that's not on
listserves.
---------------------------(end of broadcast)---------------------------
TIP 9: the planner will ignore your desire to choose an index scan if your
joining column's datatypes do not match
On Tue, 09 Sep 2003 09:36:08 -0400
Scott Cain <ca**@cshl.org> wrote: You might want to take a look at a Perl module, SQL::Translator, which translates schema elements (table creates, indexes, views) from one DB's SQL to another. I don't know if the S::T on CPAN is up to date, so you might want to try their website to get the CVS version:
http://sqlfairy.sourceforge.net/
Funny name, thanks. It's amazing how I didn't find this via google.com.
Is it just me or is google less effective than it once was? Sure seems like it.
I think they're going to have to modify their model. Scott
On Tue, 2003-09-09 at 02: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) );
I get a parse error: ERROR: parser: parse error at or near "(" at character 279
---------------------------(end of broadcast)--------------------------- TIP 8: explain analyze is your friend -- ------------------------------------------------------------------------ Scott Cain, Ph. D. ca**@cshl.org GMOD Coordinator (http://www.gmod.org/) 216-392-3087 Cold Spring Harbor Laboratory
---------------------------(end of broadcast)--------------------------- TIP 7: don't forget to increase your free space map settings
---------------------------(end of broadcast)---------------------------
TIP 7: don't forget to increase your free space map settings
expect wrote: On Tue, 09 Sep 2003 09:36:08 -0400 Scott Cain <ca**@cshl.org> wrote: You might want to take a look at a Perl module, SQL::Translator, which translates schema elements (table creates, indexes, views) from one DB's SQL to another. I don't know if the S::T on CPAN is up to date, so you might want to try their website to get the CVS version:
http://sqlfairy.sourceforge.net/
Funny name, thanks. It's amazing how I didn't find this via google.com. Is it just me or is google less effective than it once was? Sure seems like it. I think they're going to have to modify their model. Scott
On Tue, 2003-09-09 at 02: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) );
I get a parse error: ERROR: parser: parse error at or near "(" at character 279
---------------------------(end of broadcast)--------------------------- TIP 8: explain analyze is your friend
-- ------------------------------------------------------------------------ Scott Cain, Ph. D. ca**@cshl.org GMOD Coordinator (http://www.gmod.org/) 216-392-3087 Cold Spring Harbor Laboratory
---------------------------(end of broadcast)--------------------------- TIP 7: don't forget to increase your free space map settings
---------------------------(end of broadcast)--------------------------- TIP 7: don't forget to increase your free space map settings
I think google's reach into technical sites is diminishing. We generate
SOOOOOOOOOOOO much traffic on all the open source AND closed source
discussion groups, it's staggering.
Jeesh, it would be intereseting to know how many words, characters, etc
were in each of those domains. I be the folks at marc.theaimsgroup.com
could give us an idea about thiers plus add in sourceforge, and it'd be
a major part of it. Well, then there's the stuff on usenet that's not on
listserves.
---------------------------(end of broadcast)---------------------------
TIP 9: the planner will ignore your desire to choose an index scan if your
joining column's datatypes do not match This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Gordon |
last post by:
I have 2 tables t and t1. In this case, t1 is a copy of t. I want to
delete rows from t1 based on criteria on the t table and a relationship
between t ad t1 (in this case the id column). In the...
|
by: jacob nikom |
last post by:
I would like to create data model for a group of stores.
All stores in this group are very similar to each other, so it is
natural
to allocate one MySQL database per store. Each database is going...
|
by: Ed Smith |
last post by:
I have two questions about REFERENCES:
1. It appears that mySQL treats REFERENCES associated with an
attribute differently than FOREIGN KEY (<blah>) REFERENCES...
Specifically, the first form...
|
by: Mike Chirico |
last post by:
Interesting Things to Know about MySQL
Mike Chirico (mchirico@users.sourceforge.net)
Copyright (GPU Free Documentation License) 2004
Last Updated: Mon Jun 7 10:37:28 EDT 2004
The latest...
|
by: Good Man |
last post by:
Hi there
I've noticed some very weird things happening with my current MySQL setup
on my XP Laptop, a development machine.
For a while, I have been trying to get the MySQL cache to work....
|
by: paulq182 |
last post by:
PLEASE HELP ME WITH MY CODE??
import java.sql.*;
import java.io.*;
class min_filmdb_rel_mysql {
public static void main (String args )
throws SQLException, IOException {
|
by: Atli |
last post by:
This is an easy to digest 12 step guide on basics of using MySQL. It's a great refresher for those who need it and it work's great for first time MySQL users.
Anyone should be able to get...
|
by: Atli |
last post by:
You may be wondering why you would want to put your files “into” the database, rather than just onto the file-system. Well, most of the time, you wouldn’t.
In situations where your PHP application...
|
by: ssnaik84 |
last post by:
Hi Guys,
Last year I got a chance to work with R&D team, which was working on DB scripts conversion..
Though there is migration tool available, it converts only tables and constraints..
Rest of...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
| |