Re: [PERFORM] Query in SQL statement

From: "R, Rajesh (STSD)" <rajesh(dot)r2(at)hp(dot)com>
To: "Richard Huxton" <dev(at)archonet(dot)com>
Cc: <pgsql-hackers(at)postgresql(dot)org>, <pgsql-performance(at)postgresql(dot)org>
Subject: Re: [PERFORM] Query in SQL statement
Date: 2005-10-05 09:03:15
Message-ID: 5CBFB210D9870F40B9E5A0FBD31F3A77028FD2A8@bgeexc01.asiapacific.cpqcorp.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-performance


Thanks.
I've already understood that
I need to post it in another list.

Sorry for wasting your precious time.

--
Rajesh R

-----Original Message-----
From: Richard Huxton [mailto:dev(at)archonet(dot)com]
Sent: Wednesday, October 05, 2005 2:24 PM
To: R, Rajesh (STSD)
Cc: pgsql-hackers(at)postgresql(dot)org; pgsql-performance(at)postgresql(dot)org
Subject: Re: [PERFORM] Query in SQL statement

R, Rajesh (STSD) wrote:
>
> Am trying to port a mysql statement to postgres.
>
> Please help me in finding the error in this,

Can I recommend the reference section of the manuals for this sort of
thing? There is an excellent section detailing the valid SQL for the
CREATE TABLE command.

Also - the pgsql-hackers list is for discussion of database development,
and the performance list is for performance problems. This would be
better posted on pgsql-general or -sql or -novice.

> CREATE SEQUENCE ai_id;

This line is causing the first error:
> ERROR: relation "ai_id" already exists

That's because you've already successfully created the sequence, so it
already exists. Either drop it and recreate it, or stop trying to
recreate it.

> 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,

Well, "Date" is a type-name, "datetime" isn't and even if it was
"0000-00-00" isn't a valid date is it?

> Reason varchar(200),
> Admin varchar(30) DEFAULT '-',
> PRIMARY KEY (id),
> KEY UserName (UserName),
> KEY Date (Date)

The word "KEY" isn't valid here either - are you trying to define an
index? If so, see the "CREATE INDEX" section of the SQL reference.

http://www.postgresql.org/docs/8.0/static/sql-commands.html

If you reply to this message, please remove the pgsql-hackers CC:
--
Richard Huxton
Archonet Ltd

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Richard Huxton 2005-10-05 09:09:20 Re: Query in SQL statement
Previous Message Richard Huxton 2005-10-05 08:54:11 Re: Query in SQL statement

Browse pgsql-performance by date

  From Date Subject
Next Message Richard Huxton 2005-10-05 09:09:20 Re: Query in SQL statement
Previous Message Richard Huxton 2005-10-05 08:54:58 Re: Which one FreeBSD or Linux