Re: Minor inheritance/check bug: Inconsistent behavior

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
Cc: Rushabh Lathia <rushabh(dot)lathia(at)gmail(dot)com>, Bruce Momjian <bruce(at)momjian(dot)us>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Minor inheritance/check bug: Inconsistent behavior
Date: 2013-09-19 16:58:11
Message-ID: CA+TgmoYf+inMB-_EU_u4pr7HNifgiWma1MF8xB+hGnAaX8M=eQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

>> Marking this as Ready for committer.
>
> Thanks a ton for reviewing the patch.

I rewrote the comments for this patch and fixed the incorrect
formatting in parse_relation.c. It used spaces instead of tabs, which
is why if you look at the patch file you'll see that the alignment
looked off. See new version, attached.

However, I have a few residual questions:

1. Does copy.c also need to be fixed? I see that it also calls
ExecConstraints(), and I don't see it setting tableOid anywhere. We
certainly want COPY and INSERT to behave the same way.

2. Should constraints also allow access to the "oid" column? Right
now you can do that but it doesn't seem to work, e.g.:

rhaas=# create table foo (a int, check (oid::integer % 2 = 0)) with oids;
CREATE TABLE
rhaas=# insert into foo values (1);
INSERT 16404 1
rhaas=# insert into foo values (1);
INSERT 16405 1
rhaas=# insert into foo values (1);
INSERT 16406 1
rhaas=# select oid, * from foo;
oid | a
-------+---
16404 | 1
16405 | 1
16406 | 1
(3 rows)

Just prohibiting that might be fine; it doesn't seem that useful
anyway. But if we're setting the table OID, maybe we should set the
OID too, and then just allow this.

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

Attachment Content-Type Size
sys_col_constr_v3.patch application/octet-stream 4.5 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2013-09-19 17:03:53 Re: Re: Proposal/design feedback needed: WITHIN GROUP (sql standard ordered set aggregate functions)
Previous Message Andrew Gierth 2013-09-19 16:52:46 Re: Re: Proposal/design feedback needed: WITHIN GROUP (sql standard ordered set aggregate functions)