pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Devrim GUNDUZ <devrim@gunduz.org>
To: Nosyman <nosyman@easymail.ro>
Cc: pgsql-sql@postgresql.org
Subject: Re: PRIMARY KEY and INDEX
Date: Thu, 2 Sep 2004 17:48:35 +0300 (EEST)
Message-ID: <Pine.LNX.4.61.0409021747590.1213@emo.org.tr> (raw)
In-Reply-To: <200409021358.i82DwGQ8022806@acten.itcnet.ro>
References: <200409021358.i82DwGQ8022806@acten.itcnet.ro>

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1


Hi,

On Thu, 2 Sep 2004, Nosyman wrote:

> It is necessary to define an index for a primary key column?
>
> Let's have an example
> CREATE TABLE users(
> id_user INTEGER PRIMARY KEY,
> user_name VARCHAR(25)
> );
>
> Does PgSQL automatically create an index for id_user (primary key) or it
> must be created by hand?

You could give it a try before asking:

test=# CREATE TABLE users(
test(# id_user INTEGER PRIMARY KEY,
test(# user_name VARCHAR(25)
test(# );
NOTICE:  CREATE TABLE / PRIMARY KEY will create implicit index 
"users_pkey" for table "users"
CREATE TABLE

Regards,
- --
Devrim GUNDUZ 
devrim~gunduz.org				devrim.gunduz~linux.org.tr
 			http://www.tdmsoft.com
 			http://www.gunduz.org
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (GNU/Linux)

iD8DBQFBNzLFtl86P3SPfQ4RAuOZAKDoE5NFtu7B3Dg356+CH5P9CGp7cgCfaBQm
33nie6C/x2PIfA0D1zqWgLE=
=QlUA
-----END PGP SIGNATURE-----



view thread (3+ messages)  latest in thread

Message-ID: <Pine.LNX.4.61.0409021747590.1213@emo.org.tr>
Permalink:  ../Pine.LNX.4.61.0409021747590.1213@emo.org.tr/
Also on:    postgresql.org/message-id/Pine.LNX.4.61.0409021747590.1213@emo.org.tr

 · 

reply

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-sql@postgresql.org
  Cc: devrim@gunduz.org, nosyman@easymail.ro
  Subject: Re: PRIMARY KEY and INDEX
  In-Reply-To: <Pine.LNX.4.61.0409021747590.1213@emo.org.tr>

* 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