Re: ADD/DROP constraints - Mailing list pgsql-hackers

From Greg Stark
Subject Re: ADD/DROP constraints
Date
Msg-id 874pyui3sj.fsf@stark.xeocode.com
Whole thread Raw
In response to Re: ADD/DROP constraints  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: ADD/DROP constraints  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
Tom Lane <tgl@sss.pgh.pa.us> writes:

> I fear you'll have to actually reverse-compile the conbin strings and see if
> you get a match.

There seems to be something I'm missing wrt the conbin string. I have a table
here with a simple check constraint:

          Table "public.a"    Column |  Type   | Modifiers    --------+---------+-----------    i      | integer |
Checkconstraints:       "x" CHECK (i = 0)
 


But when I loop around looking at the constraints the conbin text field has an
empty string in it:
   (gdb) p *con   $2 = {conname = {data = "x", '\0' <repeats 62 times>, alignmentDummy = 120},      connamespace =
2200,contype = 99 'c', condeferrable = 0 '\0',      condeferred = 0 '\0', conrelid = 24661, contypid = 0, confrelid =
0,     confupdtype = 32 ' ', confdeltype = 32 ' ', confmatchtype = 32 ' ',      conkey = {26}, confkey = {0}, conbin =
{vl_len= 1, vl_dat = ""}, consrc = {       vl_len = 21, vl_dat = "\001"}}
 


And when I call pg_get_expr with:
    consrc = DirectFunctionCall2(pg_get_expr, PointerGetDatum(&con->conbin), ObjectIdGetDatum(con->conrelid));

I get:
   ERROR:  invalid memory alloc request size 4294967294


-- 
greg



pgsql-hackers by date:

Previous
From: Martijn van Oosterhout
Date:
Subject: Re: That EXPLAIN ANALYZE patch still needs work
Next
From: Greg Stark
Date:
Subject: Re: That EXPLAIN ANALYZE patch still needs work