Thread: I find a bug (IMHO)

I find a bug (IMHO)

From
Danger Dancer
Date:
Sorry for my bad English.
The report in the attach
If PostgreSQL failed to compile on your computer or you found a bug that
is likely to be specific to one platform then please fill out this form
and e-mail it to pgsql-ports@postgresql.org.

To report any other bug, fill out the form below and e-mail it to
pgsql-bugs@postgresql.org.

If you not only found the problem but solved it and generated a patch
then e-mail it to pgsql-patches@postgresql.org instead.  Please use the
command "diff -c" to generate the patch.

You may also enter a bug report at http://www.postgresql.org/ instead of
e-mail-ing this form.

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


Your name        :    Roman
Your email address    :    rigalkin@luch.podolsk.ru


System Configuration
---------------------
  Architecture (example: Intel Pentium)      : Intel Celeron 667

  Operating System (example: Linux 2.0.26 ELF)     : Linux 2.4.18 (Red Hat 7.3)

  PostgreSQL version (example: PostgreSQL-7.4):   PostgreSQL-7.4

  Compiler used (example:  gcc 2.95.2)        : gcc 2.97


Please enter a FULL description of your problem:
------------------------------------------------
Sorry, my English very bad, but i try write it
The pg_dump not save changes as ALTER TABLE DROP CONSTRAINT in case with inheritans table


Please describe a way to repeat the problem.   Please try to provide a
concise reproducible example, if at all possible:
----------------------------------------------------------------------
#little example
create table a (d int check (d<5));
create table b () inherits (a);
alter table b drop constraint "a_d";
#after it, table b not have any constraint. Try save and restore the structure of database
#in shell:
pg_dump -s -f ~/dbtest -U postgres test
#in psql:
drop database test;
create database test;
#in shell:
psql test postgres < ~/dbtest
#Now, table b have constraint "a_d" :(



If you know how this problem might be fixed, list the solution below:
---------------------------------------------------------------------
I don't know :(


Re: I find a bug (IMHO)

From
Tom Lane
Date:
Danger Dancer <rigalkin@luch.podolsk.ru> writes:
> #little example
> create table a (d int check (d<5));
> create table b () inherits (a);
> alter table b drop constraint "a_d";

I think the bug is that it allowed you to do this.  You should not be
able to drop an inherited constraint, any more than you can drop an
inherited column.

            regards, tom lane

Re: I find a bug (IMHO)

From
"ezra epstein"
Date:
This *might* be a case where you want to define table B using the LIKE
clause, rather than inheritance.  Then you could modify table B as you
please: dropping constraints or columns, etc.

== Ezra Epstein

Re: I find a bug (IMHO)

From
Bruce Momjian
Date:
Tom Lane wrote:
> Danger Dancer <rigalkin@luch.podolsk.ru> writes:
> > #little example
> > create table a (d int check (d<5));
> > create table b () inherits (a);
> > alter table b drop constraint "a_d";
>
> I think the bug is that it allowed you to do this.  You should not be
> able to drop an inherited constraint, any more than you can drop an
> inherited column.

Added to TODO:

        o Disallow dropping of an inherited constraint

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073