Correction of my bug report sent on 2000-01-28

From: "Herr Dumont" <dumont(at)gmx(dot)net>
To: <pgsql-bugs(at)postgresql(dot)org>
Subject: Correction of my bug report sent on 2000-01-28
Date: 2000-01-31 19:33:55
Message-ID: 002101bf6c22$85d54e20$903a06d5@powerstation
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Dear PostgreSQL Development Team !

In my bug report sent on 2000-01-28 (subject: ALTER TABLE / ADD COLUMN BUG)
I forgot to mention that the server crash only occurs if one attribute is
declared as
"PRIMARY KEY" in the initial "CREATE TABLE" statement.
However, without the "PRIMARY KEY" in the "CREATE TABLE" statement the
mentioned check (z > 9) is still not permormed.

The complete corrected bug report follows:

============================================================================
POSTGRESQL BUG REPORT TEMPLATE
============================================================================

Your name : RP. Dumont
Your email address : dumont(at)gmx(dot)net

System Configuration
---------------------
Architecture (example: Intel Pentium) : Intel
Pentium MMX

Operating System (example: Linux 2.0.26 ELF) : Linux 2.2.5 ELF
(i386)

PostgreSQL version (example: PostgreSQL-6.5.1) : PostgreSQL-6.5.1

Compiler used (example: gcc 2.8.0) : gcc
egcs-2.91.66

Please enter a FULL description of your problem:
------------------------------------------------

When I add a column to a table which contains a "PRIMARY KEY":

"ALTER TABLE mytest ADD COLUMN z INTEGER CHECK (z > 9);"

and after that doing a:

"SELECT * FROM mytest"

the new column is not displayed !!!

When I try to insert a new record in the altered table I get an error
message
saying that I specified more attribute values than the table contains (so
the newly
added column is not recognized) !

After that I tried a

"SELECT z FROM mytest"

and I got an error message saying that the backend server process terminated
abnormally
and no further processing is possible.

After restarting psql the newly added column is shown, insertions are
possible, but no
checking (z > 9) is performed.

Please describe a way to repeat the problem. Please try to provide a
concise reproducible example, if at all possible:
----------------------------------------------------------------------

First connect to a database:

psql mydb

Then create a table:

CREATE TABLE mytest (
x INTEGER PRIMARY KEY,
y INTEGER
);

Then add some values:

INSERT INTO mytest
VALUES (12,165);
...

Then add a new column with a ´CHECK´:

ALTER TABLE mytest
ADD COLUMN z INTEGER CHECK (z > 9);

After that try a:

SELECT * FROM mytest;

The newly inserted column ´z´ is not shown!
Also it is not possible to insert a new record (an error message is
printed):

INSERT INTO mytest
VALUES (37,76,16);

Finally try a:

SELECT z FROM mytest;

The backend server process crashes!

Type again:

psql mydb

and then:

SELECT * FROM mytest;

and the third column is shown, but no checking is performed when insertions
are done:

INSERT INTO mytest
VALUES (26,18,5);

is done without error message, although "CHECK (z > 9)" was specified
when the new column was added!

If you know how this problem might be fixed, list the solution below:
---------------------------------------------------------------------

Browse pgsql-bugs by date

  From Date Subject
Next Message Skeets Norquist 2000-02-01 04:02:33 SUM doesn't work on two or more columns from different tables
Previous Message Herr Dumont 2000-01-30 23:06:48 "UNIQUE" not recognized when another attribute is declared as "PRIMARY KEY"