Re: [HACKERS] ALTER TABLE parent SET WITHOUT OIDS and the oid column

2017-01-04 Thread Amit Langote
On 2017/01/05 8:05, Tom Lane wrote: > Ashutosh Bapat writes: >> Right. But I think it's better to use attribute id, in case the code >> raising this error changes for any reason in future. > > I agree. The parent's "tdhasoid" flag is definitely based on the >

Re: [HACKERS] ALTER TABLE parent SET WITHOUT OIDS and the oid column

2017-01-04 Thread Ashutosh Bapat
> >> The code updating attinhcount and then updating the catalogs is same >> for user defined attributes and OID. Should we separate it out into a >> function and use that function instead of duplicating the code? > > Didn't really seem worth the trouble ... maybe if it gets any longer > it'd be

Re: [HACKERS] ALTER TABLE parent SET WITHOUT OIDS and the oid column

2017-01-04 Thread Tom Lane
Ashutosh Bapat writes: > Right. But I think it's better to use attribute id, in case the code > raising this error changes for any reason in future. I agree. The parent's "tdhasoid" flag is definitely based on the existence of an ObjectIdAttributeNumber system

Re: [HACKERS] ALTER TABLE parent SET WITHOUT OIDS and the oid column

2016-12-27 Thread Ashutosh Bapat
>> >> We allow creating user attribute with name "oid" so you do not want to >> search system attribute oid by name. Instead search by attribute id >> ObjectIdAttributeNumber. > > Good point. Although, there can only be one of the two in a table at any > given time - either the "oid" system

Re: [HACKERS] ALTER TABLE parent SET WITHOUT OIDS and the oid column

2016-12-27 Thread Amit Langote
On 2016/12/27 22:24, Ashutosh Bapat wrote: > On Mon, Dec 26, 2016 at 3:36 PM, Amit Langote > wrote: >> Attached patches modifies MergeAttributesIntoExisting() such that we >> increment attinhcount not only for user attributes, but also for the oid >> system column

Re: [HACKERS] ALTER TABLE parent SET WITHOUT OIDS and the oid column

2016-12-27 Thread Ashutosh Bapat
On Mon, Dec 26, 2016 at 3:36 PM, Amit Langote wrote: > I suspect the following is a bug: > > create table foo (a int) with oids; > CREATE TABLE > create table bar (a int); > CREATE TABLE > alter table bar inherit foo; > ERROR: table "bar" without OIDs cannot

Re: [HACKERS] ALTER TABLE parent SET WITHOUT OIDS and the oid column

2016-12-26 Thread Amit Langote
On 2016/12/26 19:06, Amit Langote wrote: > I suspect the following is a bug: A better subject line could be: "ALTER TABLE INHERIT and the oid column" Thanks, Amit -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription:

[HACKERS] ALTER TABLE parent SET WITHOUT OIDS and the oid column

2016-12-26 Thread Amit Langote
I suspect the following is a bug: create table foo (a int) with oids; CREATE TABLE create table bar (a int); CREATE TABLE alter table bar inherit foo; ERROR: table "bar" without OIDs cannot inherit from table "foo" with OIDs alter table bar set with oids; ALTER TABLE alter table bar inherit