How to get rid of notices for create table?

Lists: pgsql-general
From: Pablo Santiago Blum de Aguiar <pbaguiar(at)yahoo(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: How to get rid of notices for create table?
Date: 2004-12-10 21:31:15
Message-ID: 20041210213115.15087.qmail@web52208.mail.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general

Hi,

I did a search for this issue but don't seem to find
anything reasonably satisfactory.

I'm getting boring notices when creating tables:

test=# CREATE TABLE cliente (
test(# id INTEGER NOT NULL,
test(# id_indica INTEGER NULL,
test(# email VARCHAR(40) NULL,
test(# contato VARCHAR(40) NULL,
test(# data DATE DEFAULT
NOW(),
test(# log VARCHAR(40) NOT NULL,
test(# num VARCHAR(16) NOT NULL,
test(# comp VARCHAR(16) NULL,
test(# bairro VARCHAR(40) NOT NULL,
test(# cep CHAR(8) NOT NULL,
test(# cidade VARCHAR(40) NOT NULL,
test(# estado CHAR(2) NOT NULL,
test(# refend VARCHAR(256) NULL,
test(# CONSTRAINT pk_cliente PRIMARY KEY (id),
test(# CONSTRAINT uk_email UNIQUE (email),
test(# CONSTRAINT ck_indica CHECK (id != id_indica)
test(# );
NOTICE: CREATE TABLE / PRIMARY KEY will create
implicit index "pk_cliente" for table "cliente"
NOTICE: CREATE TABLE / UNIQUE will create implicit
index "uk_email" for table "cliente"
CREATE TABLE

Got a few questions:

1 - What those 2 notice messages mean?
2 - How can I get rid of them?

Regards,
Scorphus.

=====
--
.''`. Pablo Aguiar <pabloaguiar at yahoo.com>
: :' : Proud Debian GNU/Linux Admin and User
`. `'` GNU/Linux User #346447 - PC #238975
`- Debian, when you have better things to do than fix a system.




_______________________________________________________
Yahoo! Mail - Agora com 250MB de espaço gratuito. Abra
uma conta agora! http://br.info.mail.yahoo.com/


From: Michael Fuhr <mike(at)fuhr(dot)org>
To: Pablo Santiago Blum de Aguiar <pbaguiar(at)yahoo(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: How to get rid of notices for create table?
Date: 2004-12-11 04:01:39
Message-ID: 20041211040139.GC62930@winnie.fuhr.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general

On Fri, Dec 10, 2004 at 06:31:15PM -0300, Pablo Santiago Blum de Aguiar wrote:

> I'm getting boring notices when creating tables:

[snip]

> NOTICE: CREATE TABLE / PRIMARY KEY will create
> implicit index "pk_cliente" for table "cliente"
> NOTICE: CREATE TABLE / UNIQUE will create implicit
> index "uk_email" for table "cliente"
> CREATE TABLE
>
> Got a few questions:
>
> 1 - What those 2 notice messages mean?

They're informational messages. PostgreSQL is telling you that
it's creating indexes that you didn't explicitly request.

> 2 - How can I get rid of them?

See the "Error Reporting and Logging" section of the "Server Run-time
Environment" chapter in the documentation. You can configure what
message levels go to the server logs and to the client.

--
Michael Fuhr
http://www.fuhr.org/~mfuhr/


From: Pablo Santiago Blum de Aguiar <pbaguiar(at)yahoo(dot)com>
To: Michael Fuhr <mike(at)fuhr(dot)org>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: How to get rid of notices for create table?
Date: 2004-12-11 22:20:06
Message-ID: 20041211222006.3131.qmail@web52203.mail.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general


--- Michael Fuhr <mike(at)fuhr(dot)org> wrote:

> On Fri, Dec 10, 2004 at 06:31:15PM -0300, Pablo
> Santiago Blum de Aguiar wrote:
>
> > I'm getting boring notices when creating tables:
>
> [snip]
>
> > NOTICE: CREATE TABLE / PRIMARY KEY will create
> > implicit index "pk_cliente" for table "cliente"
> > NOTICE: CREATE TABLE / UNIQUE will create
> implicit
> > index "uk_email" for table "cliente"
> > CREATE TABLE
> >
> > Got a few questions:
> >
> > 1 - What those 2 notice messages mean?
>
> They're informational messages. PostgreSQL is
> telling you that
> it's creating indexes that you didn't explicitly
> request.

Ok. I read the CREATE INDEX manual section and I could
create an index but then I get an error message
telling that relation "pk_cliente" already exists when
creating the table. How do I explicitly request
PostgreSQL to create those index for the table?

Thanks for your help.

=====
--
.''`. Pablo Aguiar <pabloaguiar at yahoo.com>
: :' : Proud Debian GNU/Linux Admin and User
`. `'` GNU/Linux User #346447 - PC #238975
`- Debian, when you have better things to do than fix a system.

__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com


From: Michael Fuhr <mike(at)fuhr(dot)org>
To: Pablo Santiago Blum de Aguiar <pbaguiar(at)yahoo(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: How to get rid of notices for create table?
Date: 2004-12-12 00:40:17
Message-ID: 20041212004017.GA43034@winnie.fuhr.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general

On Sat, Dec 11, 2004 at 02:20:06PM -0800, Pablo Santiago Blum de Aguiar wrote:

> Ok. I read the CREATE INDEX manual section and I could
> create an index but then I get an error message
> telling that relation "pk_cliente" already exists when
> creating the table. How do I explicitly request
> PostgreSQL to create those index for the table?

You could omit the PRIMARY KEY and UNIQUE constraints in the table
definition and create UNIQUE indexes after creating the table. But
what problem are you trying to solve? Your original message asks
how to get rid of the NOTICE messages for the implicitly-created
indexes; you can do this by setting configuration variables that
tell PostgreSQL what level of messages you want to see.

--
Michael Fuhr
http://www.fuhr.org/~mfuhr/