Re: Bug?? -- Alter table drop constraint doesn't seem to work on a primary key constraint in 7.2beta2

Поиск
Список
Период
Сортировка
От Barry Lind
Тема Re: Bug?? -- Alter table drop constraint doesn't seem to work on a primary key constraint in 7.2beta2
Дата
Msg-id 3BEC778E.3050802@xythos.com
обсуждение исходный текст
Ответ на Bug?? -- Alter table drop constraint doesn't seem to work on a primary key constraint in 7.2beta2  (Barry Lind <barry@xythos.com>)
Ответы Re: Bug?? -- Alter table drop constraint doesn't seem to work on a primary key constraint in 7.2beta2  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: Bug?? -- Alter table drop constraint doesn't seem to work on a primary key constraint in 7.2beta2  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
Tom,

I was looking at the 7.2 docs online at developer.postgresql.org.  The 
only example of 'drop constraint' in the text for the 'alter table' 
command shows its usage without the RESTRICT/CASCADE option.  I also 
noticed that RESTRICT/CASCADE is not defined in the description of alter 
table so I am not really sure what each does.

But I still can't get it to work for me.  Consider the following test case:

create table test (col_a integer not null, col_b text);
alter table test add constraint test_pk primary key (col_a);
alter table test drop constraint test_pk restrict;
alter table test drop constraint test_pk cascade;

produces the following output:

files31=# \i test.sql
CREATE
psql:test.sql:6: NOTICE:  ALTER TABLE / ADD PRIMARY KEY will create 
implicit index 'test_pk' for table 'test'
CREATE
psql:test.sql:8: ERROR:  ALTER TABLE / DROP CONSTRAINT: test_pk does not 
exist
psql:test.sql:10: ERROR:  ALTER TABLE / DROP CONSTRAINT does not support 
the CASCADE keyword


Notice that it doesn't seem to be able to drop the primary key 
constraint that was just created when I use the RESTRICT keyword and it 
claims not to support the CASCADE keyword at all.

thanks,
--Barry



Tom Lane wrote:

> Barry Lind <barry@xythos.com> writes:
> 
>>files31=# alter table XYF_FILES DROP CONSTRAINT XYF_FILES_PK;
>>ERROR:  parser: parse error at or near ";"
>>
> 
> You forgot the RESTRICT/CASCADE option.
> 
> 
>>I am assuming that this syntax should work because it is documented in 
>>the 7.2 docs.
>>
> 
> If it's documented without the option then the docs are in error;
> where are you looking?
> 
>             regards, tom lane
> 
> 




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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: best method of reloading pg_hba.conf
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Bug?? -- Alter table drop constraint doesn't seem to work on a primary key constraint in 7.2beta2