From: | Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> |
---|---|
To: | Curt Sampson <cjs(at)cynic(dot)net> |
Cc: | pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: pg_dump and CHECK constraints |
Date: | 2004-02-12 16:36:21 |
Message-ID: | 200402121636.i1CGaL800622@candle.pha.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Curt Sampson wrote:
>
> I notice that pg_dump is still dumping CHECK constraints with the table,
> rather than at the very end, as it does with all the other constraints.
> As discussed in bug report #787, at
>
> http://archives.postgresql.org/pgsql-bugs/2002-09/msg00278.php
>
> this breaks your restore if your CHECK constraint uses a user-defined
> function.
>
> 1. Does anybody have any plans to fix this in the very near future?
>
> 2. If not, is there something that makes it particularly hard to
> fix? I notice, Tom, that in your reply to that bug report you
> intimated that this wasn't an easy fix, but I don't see why CHECK
> constraints couldn't be added at the end of the dump, just as all
> the other constraints are. Presumably, your message being late 2002,
> this was before pg_dump was modified to re-order stuff?
>
> 3. If we created a patch for this at my work, would it be accepted?
>
> I dunno...this looks really easy to me....
Please check CVS. I think Tom did some big work on dependency dumping.
If I do:
test=> CREATE FUNCTION func(INT) returns bool AS 'SELECT TRUE'
test-> LANGUAGE 'SQL';
CREATE FUNCTION
test=> CREATE TABLE yy (x INT CHECK (func(x) = TRUE));
CREATE TABLE
test=> INSERT INTO yy VALUES (1);
INSERT 17576 1
and in pg_dump output I see:
--
-- Name: func(integer); Type: FUNCTION; Schema: public; Owner: postgres
--
CREATE FUNCTION func(integer) RETURNS boolean
AS 'select true'
LANGUAGE sql;
--
-- Name: yy; Type: TABLE; Schema: public; Owner: postgres
--
CREATE TABLE yy (
x integer,
CONSTRAINT yy_x CHECK ((func(x) = true))
) WITH OIDS;
so this might be fixed in CVS already.
--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2004-02-12 17:06:44 | Re: Idea about better configuration options for sort memory |
Previous Message | scott.marlowe | 2004-02-12 16:18:53 | Re: Idea about better configuration options for sort memory |