Re: BUG #2144: Domain NOT NULL constraints ignored in rules

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: john(at)supplee(dot)com
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #2144: Domain NOT NULL constraints ignored in rules
Date: 2006-01-06 20:14:31
Message-ID: 22378.1136578471@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

"John Supplee" <john(at)supplee(dot)com> writes:
> Tom Lane wrote:
>> Works for me:

> You need to modify your test case slightly.

OK, got it. Patch for 8.1 is attached if you need it. Thanks for the
test case.

regards, tom lane

Index: rewriteManip.c
===================================================================
RCS file: /cvsroot/pgsql/src/backend/rewrite/rewriteManip.c,v
retrieving revision 1.92.2.2
diff -c -r1.92.2.2 rewriteManip.c
*** rewriteManip.c 23 Nov 2005 17:21:22 -0000 1.92.2.2
--- rewriteManip.c 6 Jan 2006 19:41:30 -0000
***************
*** 18,23 ****
--- 18,24 ----
#include "optimizer/clauses.h"
#include "optimizer/tlist.h"
#include "parser/parsetree.h"
+ #include "parser/parse_coerce.h"
#include "parser/parse_relation.h"
#include "rewrite/rewriteManip.h"
#include "utils/lsyscache.h"
***************
*** 838,844 ****
else
{
/* Otherwise replace unmatched var with a null */
! return (Node *) makeNullConst(var->vartype);
}
}
else
--- 839,851 ----
else
{
/* Otherwise replace unmatched var with a null */
! /* need coerce_to_domain in case of NOT NULL domain constraint */
! return coerce_to_domain((Node *) makeNullConst(var->vartype),
! InvalidOid,
! var->vartype,
! COERCE_IMPLICIT_CAST,
! false,
! false);
}
}
else

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2006-01-06 20:56:57 Re: Reordering columns in a table
Previous Message Jim C. Nasby 2006-01-06 20:03:20 Re: Reordering columns in a table