Package: postgresql-8.1
Version: 8.1.9-0etch1
Severity: normal

The following piece of a sql session it all:

timtowtdi=> insert into users (username) values ('bar');
ERROR:  duplicate key violates unique constraint "users_pkey"
timtowtdi=> insert into users (username) values ('bar');
INSERT 0 1

an insert into a column (here unsername) that has a 'UNIQUE' constaint on it
fails when tried for the first time (although there is no such value in the
table), and succeds at the second try (nothing else is happening in the
background). It should succeed the first time and fail the second time.

Steps to reproduce the error:

run the following script:

dropdb timtowtdi
createdb timtowtdi
psql timtowtdi < schema.sql
echo "insert into users (username) values ('bar')" | psql timtowtdi
echo "insert into users (username) values ('bar')" | psql timtowtdi

try this a few times, for me it fails at all but the first run.

and this is the file schema.sql:
-- BEGIN FILE schema.sql

CREATE TABLE users (                                                    
    id          SERIAL          PRIMARY KEY NOT NULL,                   
    username    VARCHAR(20)     UNIQUE,                                 

    password    VARCHAR(255),                                           
    karma       INTEGER         DEFAULT 0,                              
    acknowledged SMALLINT       DEFAULT 0,                              
    locked      SMALLINT        DEFAULT 0,                              
    time_stamp  TIMESTAMP       DEFAULT NOW()                           
);

CREATE INDEX users_id_idx       ON users(id);
CREATE INDEX users_username_idx ON users(username);
CREATE INDEX users_karma_idx    ON users(karma);



INSERT INTO users (id, username, password, acknowledged, locked)
VALUES (1, 'admin', '', 1, 0);

-- END FILE schema.sql


-- System Information:
Debian Release: 4.0
  APT prefers stable
  APT policy: (500, 'stable')
Architecture: i386 (i686)
Shell:  /bin/sh linked to /bin/bash
Kernel: Linux 2.6.21.6
Locale: LANG=EN_US.UTF-8, LC_CTYPE=de_DE (charmap=ANSI_X3.4-1968) (ignored: 
LC_ALL set to C)

Versions of packages postgresql-8.1 depends on:
ii  libc6    2.3.6.ds1-13etch2               GNU C Library: Shared libraries
ii  libcomer 1.39+1.40-WIP-2006.11.14+dfsg-2 common error description library
ii  libkrb53 1.4.4-7etch4                    MIT Kerberos runtime libraries
ii  libpam0g 0.79-4                          Pluggable Authentication Modules l
ii  libpq4   8.1.9-0etch1                    PostgreSQL C client library
ii  libssl0. 0.9.8c-4                        SSL shared libraries
ii  postgres 8.1.9-0etch1                    front-end programs for PostgreSQL 
ii  postgres 71                              manager for PostgreSQL database cl

postgresql-8.1 recommends no packages.

-- no debconf information

-- 
Moritz Lenz
http://moritz.faui2k3.org/ |  http://perl-6.de/



-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to