X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (neptune.hub.org [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id E9569D1E224 for ; Wed, 7 Jan 2004 17:15:36 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 46355-03 for ; Wed, 7 Jan 2004 13:14:52 -0400 (AST) Received: from mail.gmx.net (pop.gmx.de [213.165.64.20]) by svr1.postgresql.org (Postfix) with SMTP id 58660D1E1C1 for ; Wed, 7 Jan 2004 13:13:04 -0400 (AST) Received: (qmail 28040 invoked by uid 65534); 7 Jan 2004 17:06:23 -0000 Received: from p508BFBB9.dip.t-dialin.net (EHLO gmx.net) (80.139.251.185) by mail.gmx.net (mp016) with SMTP; 07 Jan 2004 18:06:23 +0100 X-Authenticated: #14269776 Message-ID: <3FFC3D30.2080508@gmx.net> Date: Wed, 07 Jan 2004 18:09:04 +0100 From: Andreas User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; de-AT; rv:1.5) Gecko/20031007 X-Accept-Language: de-at, de, en-us, en MIME-Version: 1.0 To: pgsql-sql@postgresql.org Subject: Notation of index Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200401/38 X-Sequence-Number: 16431 Hi, I'm moving from MySQL to Pg. MySQL lets me create indices like this: CREATE TABLE t ( id INTEGER NOT NULL, numba INTEGER NOT NULL, txt VARCHAR(100) NOT NULL, anosanumba INTEGER NOT NULL , PRIMARY KEY (id), INDEX (numba), UNIQUE (anosanumba) ); PostgreSQL doesn't like the line : INDEX (numba), Instead I have to use : CREATE INDEX idx_t_numba ON t (numba); outside the CREATE TABLE statement. And as far as I understand I do have to give an plain INDEX explicitely a name while Pg makes one up for the UNIQUE. The point is, that I want to use foreign keys and I figure it helped if those fk-columns were indexed but PG won't create indices for columns in fk-constraints automatically. Am I right ? Why can we use INDEX the same way as UNIQUE ? Perhaps even as in ... numba INT4 NOT NULL INDEX ...