Question Regarding DELETE FROM ONLY

Поиск
Список
Период
Сортировка
От Terry Lee Tucker
Тема Question Regarding DELETE FROM ONLY
Дата
Msg-id 200605290840.43506.terry@esc1.com
обсуждение исходный текст
Ответы Re: Question Regarding DELETE FROM ONLY  (Michael Fuhr <mike@fuhr.org>)
Список pgsql-general
Hello List:

Please observe the following example that reproduces my problem:

CREATE TABLE ptable (code VARCHAR) WITHOUT OIDS;
CREATE TABLE

CREATE TABLE ctable (code VARCHAR, name VARCHAR)
    INHERITS (ptable) WITHOUT OIDS;
NOTICE:  merging column "code" with inherited definition
CREATE TABLE

INSERT INTO ctable (code, name) VALUES ('code_one', 'Code One');
rnd=# SELECT * FROM ptable;
   code
----------
 code_one
(1 row)

rnd=# SELECT * FROM ctable;
        code   |   name
---------------+----------
 code_one | Code One
(1 row)

DELETE FROM ONLY ctable WHERE code ~* 'code_one';

rnd=# SELECT * FROM ptable;
 code
------
(0 rows)

The record in ctable AND the record in ptable are both deleted even though I
specified "ONLY ctable" in the delete phrase. Why is this happening? The two
tables in this example represent a greatly simplified version of what I'm
doing in developing an application and if "ONLY" doesn't work then I've got a
big problem. Have I misunderstood inheritance altogether?

TIA...

rnd=# select version();
                                                   version
--------------------------------------------------------------------------------------------------------------
 PostgreSQL 7.4.6 on i686-redhat-linux-gnu, compiled by GCC gcc (GCC) 3.2.3
20030502 (Red Hat Linux 3.2.3-49)
(1 row)


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

Предыдущее
От: Eci Souji
Дата:
Сообщение: Re: DB structure for logically similar objects in different
Следующее
От: "Tomi NA"
Дата:
Сообщение: Re: Best open source tool for database design / ERDs?