Re: Problem when adding an existing primary key

Поиск
Список
Период
Сортировка
От Insyde
Тема Re: Problem when adding an existing primary key
Дата
Msg-id 000b01c2cb72$6e432680$e2faabc8@insyde
обсуждение исходный текст
Ответ на Problem when adding an existing primary key  ("Insyde" <insyde@insyde.com.br>)
Список pgsql-bugs
----- Original Message -----
From: "Josh Berkus" <josh@agliodbs.com>
To: "Insyde" <insyde@insyde.com.br>; <pgsql-bugs@postgresql.org>
Sent: Sunday, February 02, 2003 6:28 PM
Subject: Re: [BUGS] Problem when adding an existing primary key


> Ricardo,
>
> > When I try to insert via application a registry that already exists
> > Postgres shows an error  "Unable to insert duplicate primary key on
index
> > 'index' ". I think it's an error, because I would treat this error, just
> > like others.
>
> You're getting that message becuase you are trying to insert a value into
the
> PK column which is a duplicate of a value already present.  This is not
> permitted ... definitionally, primary keys must be unique.
>
> In other words, the above is a valid error message being sent to you
because
> you violated a table constraint.
>
> If there is more to the story than that, I suggest that you post your
problems
> to the PGSQL-NOVICE mailing list, where other users will help you fix your
> queries.  For that matter, I believe that there are other Brazillians on
some
> of the other mailing lists (you could try PGSQL-GENERAL as well), which
would
> spare you the pain of translating your questions.
>
> --
> Josh Berkus
> Aglio Database Solutions
> San Francisco

But what if I have a program and I want to show and error message to the
user saying
something like: "This registry already exists" and simply don't add?
Instead, Postgres is
closing the application! This should not happen. If I've got this message
using psql OK,
but inside my programs I should control the messages I what to display to
the user, don't
you think? Or, every time the user forget and insert a duplicated primary
key, he will be
obbligated to see postgres message?

Ricardo.

В списке pgsql-bugs по дате отправления:

Предыдущее
От: Stefanos Harhalakis
Дата:
Сообщение: psql 7.3.1: signal 11 + replace_vars_with_subplan_refs: variable not in subplan target list
Следующее
От: "Ricardo Capurro"
Дата:
Сообщение: Troubles with JDBC method DataBaseMetaData.getTables()