bug on ALTER TABLE

Поиск
Список
Период
Сортировка
От Martin Marques
Тема bug on ALTER TABLE
Дата
Msg-id 482B7732.1060705@marquesminen.com.ar
обсуждение исходный текст
Ответы Re: bug on ALTER TABLE
Re: bug on ALTER TABLE
Список pgsql-general
Please, can someone explain how is it posible for ALTER TABLE to add a
primary key column to a table without some intruction that would make it
a real PK (NOT NULL and UNIQUE).

prueba=> CREATE TABLE nopk (
prueba(> textito varchar
prueba(> );
CREATE TABLE
prueba=> INSERT INTO nopk VALUES ('algo de texto');
INSERT 0 1
prueba=> INSERT INTO nopk VALUES ('otro texto');
INSERT 0 1
prueba=> ALTER TABLE nopk ADD COLUMN id INT PRIMARY KEY;
NOTICE:  ALTER TABLE / ADD PRIMARY KEY creará el índice implícito
«nopk_pkey» para la tabla «nopk»
ALTER TABLE
prueba=> \d nopk
              Tabla «martin.nopk»
  Columna |       Tipo        | Modificadores
---------+-------------------+---------------
  textito | character varying |
  id      | integer           | not null
Índices:
     «nopk_pkey» PRIMARY KEY, btree (id)

prueba=> SELECT * FROM nopk WHERE id IS NULL;
     textito    | id
---------------+----
  algo de texto |
  otro texto    |
(2 filas)


So id is a pk with NULL values, which isn't right.

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

Предыдущее
От: Greg Smith
Дата:
Сообщение: Re: DB page cache/query performance
Следующее
От: "D. Dante Lorenso"
Дата:
Сообщение: convert very large unsigned numbers to base62?