From: Christopher Kings-Lynne <chriskl@familyhealth.com.au>
To: R, Rajesh (STSD) <rajesh.r2@hp.com>
Cc: pgsql-hackers@postgresql.org
Cc: pgsql-performance@postgresql.org
Subject: Re: Query in SQL statement
Date: Thu, 29 Sep 2005 21:28:38 +0800
Message-ID: <433BEC06.40004@familyhealth.com.au> (raw)
In-Reply-To: <5CBFB210D9870F40B9E5A0FBD31F3A770283AC48@bgeexc01.asiapacific.cpqcorp.net>
References: <5CBFB210D9870F40B9E5A0FBD31F3A770283AC48@bgeexc01.asiapacific.cpqcorp.net>
> CREATE SEQUENCE ai_id;
> CREATE TABLE badusers (
> id int DEFAULT nextval('ai_id') NOT NULL,
> UserName varchar(30),
> Date datetime DEFAULT '0000-00-00 00:00:00' NOT NULL,
> Reason varchar(200),
> Admin varchar(30) DEFAULT '-',
> PRIMARY KEY (id),
> KEY UserName (UserName),
> KEY Date (Date)
> );
>
>
> Am always getting foll. Errors,
>
> ERROR: relation "ai_id" already exists
> ERROR: syntax error at or near "(" at character 240
You have just copied the Mysql code to Postgresql. It will in no way
work. Your default for 'Date' is illegal in postgresql and hence it
must allow NULLs. There is no such thing as a 'datetime' type. There
is no such thing as 'Key'. Also your mixed case identifiers won't be
preserved. You want:
CREATE TABLE badusers (
id SERIAL PRIMARY KEY,
UserName varchar(30),
Date timestamp,
Reason varchar(200),
Admin varchar(30) DEFAULT '-'
);
CREATE INDEX UserName_Idx ON badusers(Username);
CREATE INDEX Date_Idx ON badusers(Date);
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-performance@postgresql.org
Cc: chriskl@familyhealth.com.au, rajesh.r2@hp.com, pgsql-hackers@postgresql.org
Subject: Re: Query in SQL statement
In-Reply-To: <433BEC06.40004@familyhealth.com.au>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox