Re: Primary key constraint violation without error?

From: Michael Fuhr <mike(at)fuhr(dot)org>
To: Mario Splivalo <mario(dot)splivalo(at)mobart(dot)hr>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: Primary key constraint violation without error?
Date: 2006-07-24 13:05:32
Message-ID: 20060724130532.GA24454@winnie.fuhr.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On Mon, Jul 24, 2006 at 02:12:39PM +0200, Mario Splivalo wrote:
> Now I run the function again:
>
> l_netsms=# select punimessages();
> NOTICE: Ubacili smo za usera 4162.
> NOTICE: Ubacili smo za usera 4161.
> NOTICE: Ubacili smo za usera 4160.
> NOTICE: Ubacili smo za usera 4159.
> NOTICE: Ubacili smo za usera 4158.
> punimessages
> --------------
> t
> (1 row)
>
> Shouldn't I get errors that I'm violating primary key constraint when
> INSERTing again same data?

No, because punimessages() has a truncate statement that empties
the table each time the function is called. Should that truncate
statement be there?

--
Michael Fuhr

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Aaron Bono 2006-07-24 15:56:13 Re: System catalog table privileges
Previous Message Richard Huxton 2006-07-24 13:04:02 Re: Primary key constraint violation without error?